New
#10
Thanks a lot Jamie:)
and how can they have password?
Thanks a lot Jamie:)
and how can they have password?
It actually creates a password with the /random option however as it is run in a batch file you don't see that output but we can create the password differently so i have removed the /random from the below code however it depends what you want their password to be, all the same password or different?
Here are a few options:
- Manually set the password after they are created.
- Create them all with the same password (see red text)
Code:for /f %%n in (%userprofile%\desktop\users.txt) do (net user %%n password_here /add /expires:never)
3rd Option - Create them with different passwords based on a variable
This is a little different and requires 2 batch files due to the way variables work in a for loop but this is just as easy to run.
Create 2 batch files with the below codes and place them on your desktop:
Call this accounts.bat
Call this accounts2.batCode:for /f %%n in (%userprofile%\desktop\users.txt) do (set usr=%%n & call account2.bat)
Code:set rand=%random:~0,3% set usr1=%usr% net user %usr1% Password.%rand% /add /expires:never & echo %usr1% Password.%rand%>> %userprofile%\desktop\output.txt
Now, same as before...
- Put the text file users.txt with the list of names on the desktop.
- Run accounts.bat and it will create the accounts.
You will now see another text file on your desktop called output.txt, this is a list of the users created and the password assigned to it.
Essentially, it will generate a password called "Password.random_3_digits"
Example:
Regards,Code:testuser1 Password.521 testuser2 Password.123 testuser3 Password.452 etc...
Jamie
it is not working!
i did the steps and this is the output.txt after several times running accounts.bat & accounts2.bat:
Password.244
Password.245
Password.248
Password.248
Password.248
every time i run these two one line attach to output.txt & one account create.
the account's names are:
Password.244
Password.245
Password.248
Password.248
Password.248
Thanks
You should only run accounts.bat not accounts2.bat
accounts2.bat is automatically used by accounts.bat when needed.
Couple of things...
- Make sure you have users.txt on your desktop with a list of names you need to create (1 name per line do a test with 2 accounts... say test1 and test2)
- Make sure you run accounts.bat as administrator (right click accounts.bat and select run as administrator)
What output do you get then?
Regards,
Jamie