How to manage Windows user accounts through Command Prompt
When managing user accounts on a Windows PC, it often makes sense to use the Settings app. After all, it offers a graphical user interface that simplifies the process. But for those who want to manage accounts in a simpler way, they can use the net user command in Command Prompt to manage user accounts on Windows.
This tutorial will show you how to use the net user command to perform various actions on user accounts on a Windows computer.
1. List all user accounts
Before you start managing user accounts with net user, it is helpful to know all the user accounts on your computer. To list all of them, open Command Prompt with admin rights, enter the command below and press Enter key to run it:
net user
Remember the names you see because you will need them when using the net user command.
2. Display all user account information
You can also display all the important information about the user by simply typing the command net user followed by the user's name. Here is the basic syntax:
net user Username
Suppose there is a user named "Jack" on the computer. To display their account information, enter the command below, replacing Username in the command structure above with Jack :
net user Jack
After running the command, you will be able to see the user's full name, when their password expired, when they last logged in, whether they are an administrator, etc.
3. Add and remove user accounts
To add a new user in Command Prompt, you need to use the net user command followed by the name of the new account, the password you want to set, and the /add switch ( this tells net user that you are adding a user). Here is the basic syntax of the command:
net user Username Password /add
Remember that all you will create here is just a local account, but you can always switch the local account to a Microsoft account later. Here's an example of the command in action:
net user Jill Pa$$w0rd /add
After running that command, you will see that a new user, Jill, has been added to your computer. To delete an account, simply replace the /add switch with /delete without specifying a password. Here's how:
net user Jill /delete
Now, the net user will delete the account from the computer.
4. Enable and disable user accounts
If there's a user you want to temporarily restrict from accessing your account, you can simply disable that account instead of deleting it. Here is the basic syntax of that action, make sure to use the /active:no switch at the end of the command to notify net users that you are disabling it:
net user Username /active:no
So here's an example of what account deactivation would look like after replacing Username with the name of the actual user account:
net user Jack /active:no
And if you want to activate a disabled account, you just need to change /active:no to /active:yes.
5. Enable and disable domain user accounts
Sometimes, you may not want users to access all resources in a particular domain. An easier way to restrict them is to disable their accounts in that domain. You can do this by adding the /domain switch to the syntax discussed in the previous section.
Here is the syntax to disable an account on a specific domain using net user, making sure to replace Username with the name of the user you want to disable:
net user Username /domain /active:no
If you want to activate the account on a domain, simply use the /active:yes switch in the above command structure instead .
6. Set user account login time
If you want to specify how long someone can log in, you can use the /time parameter to specify the account login time. You can use the basic syntax below:
net user Username /time login_times
In the above command structure, replace Username with the user for whom you want to limit login times and login_times with the time range in DD,00:00 format . Here's an example of how you do this:
net user Jack /time:M-F,09:00-17:00
According to the example above, that user can only log in Monday through Friday between 9am and 5pm. If Jack tries to log in, he will receive a message saying Your account has time restrictions that prevent you from signing in .
To remove the time limit, use the command below:
net user Jack /time:all
Now, Jack can log back in whenever he wants.
7. Set user account expiration date
By default, accounts are set to never expire, but you can change that if you have users that you want to be active for a specific period of time. You will need to use the /expires parameter while specifying the year, month, and expiration date. Here is the basic command structure:
net user Username /expires:DD/MM/YYYY
An example of this in practice would be:
net user Jack /expires:27/07/2024
With the above command, Windows will disable the date you set above.
8. Change the user account password
You can also use the net user command to change the password of a user account in Command Prompt. This will make it possible to quickly change the password of any local account with a single command, instead of having to do it through the Settings app, which requires multiple clicks.
The beauty of it is that you can also use it to change passwords for multiple accounts without leaving the Command Prompt window.
9. Change domain user account password
You can also change the password of a user on a domain by adding the /domain switch to the end of the command to change the user account. The syntax for this is as follows:
net user Username NewPassword /domain
Again, this must be a local domain user account for the command to work. So, if you changed your user account from a Microsoft account to a local account, you will need to switch it back to use the command.
10. Set up password policy for users
If you need a specific user to change their password the next time they log in, you can use the net user command with the / passwordchg:yes parameter (by default, this parameter is /passwordchg:no ) . Here is the basic syntax:
net user Username /passwordchg:yes
Here's an example of what it looks like in Command Prompt:
net user Jack /passwordchg:yes
So, the next time Jack logs on to his computer, he will receive a prompt requiring him to change his password before he can access his user account.
11. Set up home directory for users
When creating a new user profile using net user, you can set the home directory, which is where Windows will store the user's personal files and settings. By default, Windows places each user account's home directory in This PC > Local Disk (C:) > Users . To change this for net users during account creation, the basic syntax is as follows:
net user Username Password /add /homedir:Path-to-directory
A practical example of this command would be:
net user Jack Pa$$w0rd /add /homedir:D:Other UsersJack
The above command will place the home directory for Jack, upon account creation, in the D:Other UsersJack folder.
You should read it
- How to Add and Delete Users Accounts With Command Prompt in Windows
- Manage User on Windows by command in CMD
- Use the Command Prompt to add or delete User accounts
- Guide 5 ways to delete User accounts on Windows 10
- Add Command Prompt to Power User Menu on Windows 10
- 4 ways to switch user accounts on Windows 11
- The command changes user in Windows
- How to use the command history function in Command Prompt
- Instructions on how to create a new User on Windows 10
- How to Manage Users in Linux
- Instructions for using Command Prompt
- How to change Windows user account password using Command Prompt
Maybe you are interested
This is the culprit that prevents users from updating Windows 11 24H2
How to switch users on the Linux command line
4 reasons why users are looking forward to the Samsung Galaxy S25 Ultra
5 things Pro users may have to give up to switch to iPhone 17 Air
Mozilla quietly adds user tracking feature in new Firefox update
8 Windows 11 features that make users decide to give up Windows 10