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