≡ Menu

Net user command : Manage user accounts from command line

Using Net user command, administrators can manage user accounts from windows command prompt. Below are some examples on how to use this command.

Add a domain user account:

Net user /add newuseLoginid  newuserPassword /domain

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.

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

Prevent users from changing their account password:

Net user loginid /Passwordchg:No

To allow users to change their password:

Net user loginid /Passwordchg:Yes

To retrieve the settings of a user:

Net user username

Example:

C:\>net user techblogger
User name                    techblogger
Full Name
Comment
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.
23 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

    cheers

    • 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

    Hi

    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.

Leave a Comment