≡ Menu

Net user command : Manage user accounts from command line

Using Net user command, administrators can manage user accounts from windows command prompt. Admins can perform different operations like add/delete user accounts, reset password, allow/prevent user to change the password and set expiry of account. This post explains syntax for each of these operations along with examples.

Add/delete user account

To add a domain user account:

Net user /add newuseLoginid newuserPassword /domain

To add new user on local computer:

Net user /add newuserLoginid newuserPassword

Advanced options to add new user account can be read in the below article.
Add new user from windows command line.

Lock/unlock user accounts

To disable/Lock a domain user account:

Net user loginid /ACTIVE:NO /domain

To enable/unlock a domain user account:

Net user loginid /ACTIVE:YES /domain

To enable/disable a local user account, run the same command without /domain

Configure password settings

To prevent users from changing their account password

Net user loginid /Passwordchg:No

To allow users to change their password:

Net user loginid /Passwordchg:Yes

Net user /expires

The /Expires option with net user command controls the expiry of user account. It does NOT control the expiry of user password. If the option is used, the user account would expire on the specified date.

net user userName /expires:MM/DD/YYYY

To never expire a user account

net user userName /expires:never

To retrieve the settings of a user:

Net user username


C:\>net user techblogger
User name                    techblogger
Full Name
User's comment
Country code                 000 (System Default)
Account active               Yes
Account expires              Never

Password last set            4/21/2011 10:10 PM
Password expires             8/19/2011 10:10 PM
Password changeable          4/21/2011 10:10 PM
Password required            Yes
User may change password     Yes

Workstations allowed         All
Logon script
User profile
Home directory
Last logon                   Never

Logon hours allowed          All

Local Group Memberships      *Users
Global Group memberships     *None
The command completed successfully.
25 comments… add one
  • Mostafa Abobakr

    thaaaaaaaaanx man for the precious information

  • Dany Balian

    One Extra Feature that might be very useful.. is to set the Password to Never Expires:

    Net user loginid /Expires:Never


    • George

      I am using the /EXPIRES:NEVER switch on the end of the command, however the Never Expires checkbow is not ticked when i check the properties

    • Ray Hurle

      Please notice that the /expires – switch prevents the the account from expiring, but not to the password.

    • admin

      That’s correct. Thanks Ray for clarifying it here for the benefit of others.

    • Ashif Chaudhary

      Use This Command To Set “Password Never Expire”

      WMIC USERACCOUNT WHERE “Name=’username_here'” SET PasswordExpires=FALSE

  • Collin Milhous

    Is there a way to change the net user username?

  • Abdul


    My question is how to create multiple users on a network through a command in command prompt using only single command line.

  • Bikash Biswal

    Very good post on windows command line. Thanks for sharing.

  • Matt

    Your command for “Add a domain user account” is incorrect, the proper one is:
    Net user domainuser domainpassword /add /domain

    Gives result:
    “The request will be processed at a domain controller for domain softros.local.
    The command completed successfully.”

  • hen

    hi how can i create multiple users from cmd
    but just with one command??

    i know for creating a new user i can use this:
    net user username password /add
    and to make him an administrator i can use this:
    net user username password administrator /add

    correct me if i’m wrong and help me please???

    • Jacob T

      Your query, [hi how can i create multiple users from cmd
      but just with one command??] – did you ever get an answer to that question ?
      Please let me know.

  • Chris

    Hi there guys

    i am currently locked out of my local administrator account on my windows server 2008 r2

    i am able to change user accounts and passwords how ever it still telling me that my username or password is incorrect.

    i have created a new user account and password but even the new user account and password doesnt work.

    please help me.

  • darren

    Is there a way to put a number of hours logon to the guest account?

  • Jacob T

    interesting stuff here .. Thanks …

  • sahba

    hi every body…
    please help me how to add users with environment variable(starting program)?

  • Abo lujain

    How can I know who changed password for a user on windows server 2008 R2 from CMD and OS?

  • KrayZ

    How can I check from our Internal domain and not our normal /domain?

  • Gabriel

    Thanks so much! However is there a line to reset a password?

  • Nigel

    Hi I have forgotten my password to get onto the two accounts set up. When I go into net user neither accounts are showing. I get a message saying
    The command completed with one or more errors
    Can anyone help

  • dilip

    hello guys in my college when i type the command “net users” it shows two accounts one is “guest” and another is “administrator” but in the login screen there are two accounts one is “guest” and another is “ADMIN” .why this ‘ADMIN’ account is not showing in the cmd.

  • Aditya

    Hey guys, so.. Uh, I was messing around with the net user commands and I think I disabled my own account. It won’t accept my password or my pin. Help me please. Thank You.

    • Christian

      You have to enter CMD and type the following:
      net user /domain /active:yes
      That will activate your disabled account for you.

      So far nobody has solved the initial question correctly. Thanks, Christian

Leave a Comment