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

How to manage Windows user accounts through Command Prompt Picture 1

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

How to manage Windows user accounts through Command Prompt Picture 2

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

How to manage Windows user accounts through Command Prompt Picture 3

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

How to manage Windows user accounts through Command Prompt Picture 4

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

How to manage Windows user accounts through Command Prompt Picture 5

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.

4 ★ | 1 Vote

May be interested

  • 6 Cool Tricks You Can Do in Windows Command Prompt6 Cool Tricks You Can Do in Windows Command Prompt
    command prompt has a ton of capabilities, and many people doubt they know what a few lines of code can do. next time you're bored with your pc, try these cool command prompt tricks for yourself.
  • How to Customize the Font in Windows Command PromptHow to Customize the Font in Windows Command Prompt
    many people work regularly with the windows command prompt. one of the main problems users encounter, however, is the difficulty of achieving the same look every time one works with the command prompt interface. this article is intended to...
  • 6 Best Command Prompt Alternatives for Windows6 Best Command Prompt Alternatives for Windows
    do you find the command prompt a bit complicated and feel you need a tool that is easier to use? this is where other terminal emulators come into play!
  • How to Make Command Prompt Appear at SchoolHow to Make Command Prompt Appear at School
    this wikihow teaches you how to access command prompt on a windows 10 school computer. although you may be able to open command prompt if only the file path to command prompt is blocked, there is no way to bypass an administrator lock on...
  • Windows promptWindows prompt
    the prompt command changes the command prompt cmd.exe file.
  • How to Create a Custom Windows Command PromptHow to Create a Custom Windows Command Prompt
    the windows command prompt (located at c:windowssystem32cmd.exe) is a useful tool to perform various administrative tasks. the prompt is a string of characters (special and non special) that are displayed whenever the command prompt is...
  • How to Open Folders in CMDHow to Open Folders in CMD
    do you need to access something from the command prompt or the windows command prompt? although it looks classic, this program is really easy to use if you know some basic commands. today's tipsmake will show you how to use the 'cd' command to open a folder in windows command prompt. besides, you will also know more great tips to instantly open command prompt in any folder on windows file explorer.
  • Use PowerShell to download any file on Windows 10Use PowerShell to download any file on Windows 10
    windows powershell is a tool built into windows 10. this tool has the ability to set up more features than command prompt, better operating system control .... most likely, powershell will replace command prompt in the future.
  • How to Execute a Program in Command PromptHow to Execute a Program in Command Prompt
    this article shows you how to open a program on a windows computer using the command prompt application. although you can only open programs that are installed in folders created by windows (such as desktop), you are still allowed to add the program's folder to the command prompt list to open the program with the command prompt.
  • How to Open Command Prompt on WindowsHow to Open Command Prompt on Windows
    today's tipsmake will show you how to open the command prompt program on windows. there are many ways to do it, from as simple as searching the start menu to using the run command. however, you should remember, some computers (such as school computers) cannot run command prompt due to restrictions.