Personal note no 6: Create Local User and add to Local group

 

Its sometimes necessary to create/add local users and add them to local groups, like administrators. Doing this as part of a Task Sequence, I find it’s easiest to use the NET command. 

Here is the syntax for user=User01 with password=Password01 (Must run after “Setup Windows and ConfigMgr” Step)

 

Create user:

CMD.exe /c net user /add User01 Pssword01

Delete user:

CMD.exe /c net user /delete User01

Add user to the administrators group:

cmd.exe /c net localgroup /add administrators User01

Set Password to newer expires: (this can not be done using Net User)

cmd.exe /c WMIC USERACCOUNT WHERE “Name=’User01′” SET PasswordExpires=FALSE

By | 2011-07-08T12:55:00+00:00 July 8th, 2011|General info, OS Deployment, Personal|4 Comments

About the Author:

Michael Petersen

Twitter: @OSDeployLinkedin: Michael PetersenMicrosoft Community Contributor

4 Comments

  1. Stephen July 27, 2011 at 1:31 - Reply

    This is helpful Michael, but how do you prevent the password from expiring?

    Thanks!
    Stephen

    • Michael Petersen
      Michael Petersen August 11, 2011 at 10:27 - Reply

      You can’t do this with Net User, but WMIC works like a charm for this.. I added the syntax to the post… be aware of the single quotations around the user name, the must be there ! ‘User01’

  2. keith April 30, 2015 at 17:06 - Reply

    Hello,

    Good find, I did have to use /y command for the add user otherwise the task sequence will hang when password is complex.

  3. Ture KArlsson July 15, 2016 at 7:31 - Reply

    How can I set a blank password (NO PASSWORD)?

Leave A Comment