Monday, June 13, 2011

Add and remove users by command prompt.....

While doing our project, we came to a position where we needed to have abt 40-50 users in SAM database and to add them using GUI would be a very lengthy process.

So we decided to use command prompt.

All you have to do is to create a .BAT file and add the following command to it.

net user (username) (password) /add /comment:"Test user, DELETE ME"
net user Rahul abcd /add /comment:"Test user, DELETE ME"

So, add the user names and passwords below one by one and run the bat file. All will be added.

To remove them, again create a .bat file and use this command.

net user Rahul /delete

So, we just created the file, added 20-30 lines with username and password and got them added to database.

INTERESTING POINT:-
You can also create a prank with them.
1. Just create the bat file with 30-40 user list to be added.
2. Name it like game.bat or some other name so that other user clicks on it.
If he will click, all the accounts will be created on his computer. And you know the password as well.....

It will lead to so many accounts appearing at the time of login and will take a lot of time showing the login screen.

For removing them, you need to provide him the simple remove.bat file with remove command for all users and he can successfully remove all the user accounts.

Thanks for reading the post.... :)

No comments:

Post a Comment