Net User: CMD Command to Create Users and Change Passwords
In this tutorial, you will learn how to use the net user command to create, delete and change user accounts in the Windows command prompt (CDM).
We can perform the following tasks using the net user command:
- View user accounts.
- Add and Remove user accounts.
- Activate and Deactivate user accounts.
- Change the user password.
If you are operating in an Active Directory domain environment, always use the /domain command switch to execute the net user command on the domain controller rather than on the local computer.
Examples
List users on the local computer:
net userList users on the domain controller:
net user /domainThis command displays detailed information about the Administrator account:
net user AdministratorCreate a user named user1 with a password of strongPassword:
net user /add user1 "strongPassword"Delete the user user1 from the computer:
net user /delete user2This command enables the built-in Administrator account on Windows 10/11:
net user Administrator /active:yesThis command sets (changes) the Administrator account password:
net user Administrator "adminPassWord"Execute the following command to disable the Administrator account on Windows 10/11:
net user Administrator /active:noThis command forces the user user1 to change the password at the next logon:
net user user1 /logonpasswordchg:yesCreate a user; the user must change the password at the next logon:
net user /add user1 "strongPassword" /logonpasswordchg:yesCreate a new user; the account expires on January 31st:
net user /add user1 "strongPassword" /expires:01/31/2023Command Options
| username | The name of the user to create, delete, view, or modify. | 
| password | Password for the user. | 
| * | Use this option to produce a prompt for the password. | 
| /add | Use this option when you want to create a new user. | 
| /delete | Use this option to remove a user from the Windows system. | 
| /active:{yes | no} | Activates or Deactivates a user. The default is yes when creating a new user. | 
| /expires:{date | never} | Use this option to set the expiration date (mm/dd/yy) for an account. The default is never. | 
| /fullname:"name" | Full name of the user. | 
| /passwordchg:{yes | no} | Specifies whether users can change their own password. The default is yes. | 
| /passwordreq:{yes | no} | No means the user can log in without a password. The default is YES. | 
| /logonpasswordchg:{yes|no} | Specifies whether the user should change the password at the next logon. The default is NO. | 
| /homedir:path | The home directory location. | 
| /comment:"text" | Use this option to add a description to the user's account. | 
You can view the manual page by typing net help user at the command prompt.
View a User
When you execute the net user command without any options, it displays a list of user accounts on the computer.
net userYou will see an output similar to the following:

Add the /domain command switch if you want to list users on the Active Directory Domain controller.
net user /domainTo see detailed information about a particular user, execute the command net user Username, where the Username is the name of the user you want to view. For example, you can view the Administrator account by running the following command:
net user AdministratorCreate and Delete User Accounts
To create a user account, use the following syntax:
net user /add UserName PasswordFor example, the following command creates a user named user1 with a password of strongPassword:
net user /add user1 "strongPassword"Use an asterisk (*) in place of the password to produce a prompt, as shown in the following example:
net user /add user1 *
Alternatively, you can also use the /random option to generate a strong random password, as shown in the following example:
net user /add user1 /randomThe randomly generated password will be displayed on the command prompt after you execute the command.

To delete a user, use the following syntax:
net user /delete UserNameThe following command deletes the user user1 from the computer:
net user /delete user2Change Passwords
To change passwords, use the following syntax:
net user UserName New-PasswordUse an asterisk (*) or /random in place of the password to produce a prompt or generate a random password:
net user UserName *
net user user1 /randomNotes
The net user command is most of the time used in Windows Server to manage Active Directory users.
Windows 10/11 uses a new Settings pane to manage users, but the net user command is still useful for some tasks. For example, if you want to activate the built-in Administrator account, it is easy to do that using this command.
While working at the command prompt, run the net help user command to see all available command options.
In the next tutorial, we are going to learn how to manage Windows groups using the net localgroup CMD command.