1. Export the user accounts into a text file. Right click on the my computer or computer icon and click manage. Then click on local users and groups and right click on users click export list type the name of the file ( I named mine userlist.txt ) ( file) .txt and save it to the c drive. (c:\userlist.txt)
You text file should look like this:
Name Full Name Description
administrator administrator Built-in account for administering
Guest Guest Built-in account for guest access to the computer/domain
2. Now you can edit the text file and leave just the usernames.
administrator
Guest
3. Create a new text file and copy the following into it:
:: This line creates a username from the list and set's the password to admin
for /f "tokens=1" %%a in (userlist.txt) do net user %%a admin /add
:: This line adds them to a local group like Backup Operators
for /f "tokens=1" %%a in (userlist.txt) do net localgroup Backup Operators %%a /add
:: This line removes them from a local group like users
for /f "tokens=1" %%a in (userlist.txt) do net localgroup users %%a /delete
:: This line makes a directory for it on the c:\ftproot\localuser
for /f "tokens=1" %%a in (userlist.txt) do mkdir C:\ftproot\localuser\%%a
4. Rename the text file you pasted that into to user.cmd
5. Run it.
Advice: I would suggest you try a list with 2 names in it first work out the bugs before you do the full import.
Thats it.
Variations on this idea
What if you want to keep the passwords:
You need to a password text file and put it in with the user names separated by a tab
administrator
Guest
:: This line creates a username and set's the password to second entry in the list
for /f "tokens=1,2" %%a in (userlist.txt) do net user %%a %%b /add
What if you want to random passwords:
:: This line creates a username and Randomizes the password and redirects it into a c:\passwords.txt file.
for /f "tokens=1" %%a in (userlist.txt) do net user %%a /add /random /passwordchg:yes >c:\passwords.txt
No comments:
Post a Comment