≡ 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 username  newuserPassword /domain

Add new user on local computer:

Net user /add username  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 username  /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 username  /Passwordchg:No

To allow users to change their password:

Net user username  /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.
39 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.

    • phc

      with a loop for.
      FOR/L %variable IN (start, step, end) DO command [Settings]

      for /L %U in (10,1,20) do net user user-%U Password /add /dom
      (to create 10 users named user-10, user-11 to user-20)

      check FOR /F [“options”] %%parameter IN (“Text string to process”) DO command
      it’s works but not secure

      Use PowerShell command for a domain
      New-ADUser …
      see : https://technet.microsoft.com/fr-fr/library/hh852238(v=wps.630).aspx

  • 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.

  • Nancy

    Is there a command line command to add a group or user name under the security tab option Group or user names: for a domain user?

  • mix

    How to check a user which was created in a different trusted domain. Not to the machine joined.

  • Shiv

    How can we check for an account creation or disablement date in cmd

    How can we run a command to replace the email address in AD from powershell

  • ofir

    Hi

    I need your assistance with batch command tomake this change in my secpol.msc!

    i need to set the “password policy” > Password must meet complexity….. to be DISABLED or ENABLED

    thanks ahead!

  • Abhishek

    Just be aware that unlocking/enabling a user account also sets it so that the password must be changed on next logon.

  • DJH

    I limit login time with “net user time” command of our son account on W10, but when time expire … he is logout from his User account and login under Admin account WITHOUT been asked for Admin´s password!

    Any idea why? Thank you.

  • man

    Please help me can you find the password for profile, when you are on it.

  • The article seems to think these are the same things.
    They are NOT:

    Enabled/disable an account.
    Lock/unlock an account.

  • Avraham Nachshon Bookatz

    why does the last logon line read “never”? i have this with my current user which i am trying to time restrict. it wont restrict because it claims to have never logged in.

  • Dipesh

    How can I pull the information of a user who is the different domain in Active Directory like IN or BR or AR?

  • Derek

    Hello,
    Great read! I am hoping u can help me. I am trying to set time limits for a user. However it completed successfully and still allows user to logon when he is not supposed too! Any advice.

  • prajuwal

    what command i can use get net user status in a single query ?i looking for the format
    example
    account status
    admin enabled

  • jagadish

    need powershell command to unlock an account , which is locked frequenltly.

    just like loop command , keep on check and unlock ad account

  • suhel

    can any help me how i can check the list of users who doest req password at the time of login

    Net user username /Passwordreq:No

  • Swagatika Mohanty

    How to check when an account has created?

Leave a Comment