User Account - Create

Page 2 of 2 FirstFirst 12

  1. Posts : 5
    Windows 7 Enterprise x64
       #10

    Thanks a lot Jamie:)
    and how can they have password?
      My Computer


  2. Posts : 2,177
    Windows 8.1 Pro x64
       #11

    MAYK said:
    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:

    1. Manually set the password after they are created.
    2. 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
    Code:
    for /f %%n in (%userprofile%\desktop\users.txt) do (set usr=%%n & call account2.bat)
    Call this accounts2.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...
    1. Put the text file users.txt with the list of names on the desktop.
    2. 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:
    Code:
    testuser1 Password.521
    testuser2 Password.123
    testuser3 Password.452
    etc...
    Regards,
    Jamie
      My Computer


  3. Posts : 5
    Windows 7 Enterprise x64
       #12

    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
      My Computer


  4. Posts : 2,177
    Windows 8.1 Pro x64
       #13

    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
      My Computer


  5. Posts : 5
    Windows 7 Enterprise x64
       #14

    nothing happen,
    no new account & no output.txt
      My Computer


  6. Posts : 2,177
    Windows 8.1 Pro x64
       #15

    MAYK said:
    nothing happen,
    no new account & no output.txt
    Sorry to hear this isn't working for you, unfortunately i can't offer any more help on it as i'm not sure what the issue it as that works for me on my Windows 7 and Windows 8 computers.

    Regards,
    Jamie
      My Computer


 
Page 2 of 2 FirstFirst 12

  Related Discussions
Our Sites
Site Links
About Us
Windows 7 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 7" and related materials are trademarks of Microsoft Corp.

© Designer Media Ltd
All times are GMT -5. The time now is 11:59.
Find Us