Mastering the Net User Command in Windows: A Comprehensive Guide

Unlock advanced user management with examples, switches, and tips for powerful user control

The Download

  • The net user command helps you see and manage all user accounts on a Windows computer.
  • You can add, remove, and change user accounts using switches like /add, /delete, and /domain.
  • Different options let you control things like passwords, login times, and allowed computers for each user.

This article describes how to use the net user command in Windows. Included on this page are the various net user switches and some examples of the net user command that you can adapt for your own commands.

Net User Command Syntax

net user [username [password | *] [/add] [options]] [/domain]] [username [/delete] [/domain]] [/help] [/?]

Refer to How to Read Command Syntax if you're unsure how to interpret the net user command syntax described above or in the table below. Availability of some Net user command options may vary between operating systems.

The net user help command results in Windows 11 Command Prompt
Net User Command Options
Option Explanation
net user Execute the net user command alone to show a very simple list of every user account, active or not, on the computer you're currently using.
username This is the name of the user account, up to 20 characters long, that you want to make changes to, add, or remove. Using username with no other option will show detailed information about the user in the Command Prompt window.
password Use the password option to change an existing password or set one when creating a new username. The minimum character requirement can be checked using the net accounts command. A maximum of 127 characters is allowed1.
* You have the option of using * instead of a password to prompt for password entry in the Command Prompt window after executing the net user command.
/add Use the /add option to add a new username on the system.
options See Additional Net User Command Options below for a complete list of available options to be used at this point when executing net user.
/domain This switch forces net user to execute on the current domain controller instead of the local computer.
/delete The /delete switch removes the specified username from the system.
/help Use this switch to display detailed information about the net user command. Using this option is the same as using the net help command with net user: net help user.
/? The standard help command switch also works with the net user command but only displays the basic command syntax. Executing net user without options is equal to using the /? switch.

[1] Windows 98 and Windows 95 only support passwords up to 14 characters long. If you're creating an account that might be used from a computer with one of those versions of Windows, consider keeping the password length within the requirements for those operating systems.

Use these options where "options" is indicated in the net user command syntax above:

Additional Net User Command Options
Option Explanation
/active:{yes | no} Use this switch to activate or deactivate the specified user account. If you don't use the /active option, net user defaults to yes.
/comment:"text" Use this option to enter a description of the account. A maximum of 48 characters is allowed. The text entered using the /comment switch is viewable in the Description field in a user's profile in Users and Groups in Windows.
/countrycode:nnn If the /countrycode switch isn't specified, the computer defaults to the country code: 000.
/expires:{date | never} The /expires switch sets a specific date (see below) when the account, not the password, should expire. If the /expires switch isn't used, never is assumed.
date (with /expires only) If you choose to specify a date then it must be in mm/dd/yy or mm/dd/yyyy format, months and days as numbers, fully spelled out, or abbreviated to three letters.
/fullname:"name" Use the /fullname switch to specify the real name of the person using the username account.
/homedir:pathname Set a pathname with the /homedir switch if you want a home directory other than the default2.
/passwordchg:{yes | no} This option specifies whether this user can change his or her own password. If this switch isn't specified, yes is assumed.
/passwordreq:{yes | no} This option specifies whether this user is required to have a password at all. If this switch isn't used, yes is assumed.
/logonpasswordchg:{yes | no} This switch forces the user to change his or her password at the next logon. Net user assumes no if you don't use this option. The /logonpasswordchg switch is not available in Windows XP.
/profilepath:pathname This option sets a pathname for the user's logon profile.
/scriptpath:pathname This option sets a pathname for the user's logon script.
/times:[timeframe | all] Use this switch to specify a timeframe (see below) that the user can log on. If you don't use /times, net user assumes that all times are permissible. If you do use this switch, but don't specify either timeframe or all, then net user assumes that no times are okay and the user is not allowed to log on.
timeframe (with /times only) If you choose to specify a timeframe you must do so in a particular way. Days of the week must be spelled out completely or abbreviated in MTWThFSaSu format. Times of day can be in a 24-hour format, or 12-hour format using AM and PM or A.M. and P.M. Periods of time should use dashes, day and time should be separated by commas and day/time groups by semicolons.
/usercomment:"text" This switch adds or changes the User Comment for the specified account.
/workstations:{computername[,...] | *} Use this option to specify the hostnames of up to eight computers that the user is allowed to log on to. This switch is really only useful when used with /domain. If you don't use /workstations to specify allowed computers then all computers (*) is assumed.

Store the output displayed on screen after running the net user command using a redirection operator. For instructions, see How to Redirect Command Output to a File.

[2] The default home directory is C:\Users\[username]\ in Windows 11, Windows 10, Windows 8, Windows 7, and Windows Vista. In Windows XP, the default home directory is C:\Documents and Settings\[username]\. For example, if the user account on a Windows 11 tablet is named "Tim," the default home directory created when the account was first set up was C:\Users\Tim\.

Net User Command Examples

Below are a few ways you might use this command.

Get the Full List of Users

This first example of the net user command shows that in its simplest form (enter net user), it will produce a list of all the users on the computer, much like this:

 Administrator            DefaultAccount           Extra Guest                    jonfi                    WDAGUtilityAccount 

This computer has over a dozen user accounts, so they're separated into multiple columns.

You can use net users instead of net user. They're completely interchangeable.

Examine One User

 net user administrator 

In the above net user example, the command produces all the details on the administrator user account. Here's an example of what might display:

 User name                    Administrator Full Name Comment                      Built-in account for administering the computer/domain User's comment Country/region code          000 (System Default) Account active               No Account expires              Never  Password last set            8/24/2020 1:21:25 PM Password expires             Never Password changeable          8/24/2020 1:21:25 PM Password required            Yes User may change password     Yes  Workstations allowed         All Logon script User profile Home directory Last logon                   11/9/2021 11:48:13 AM  Logon hours allowed          All  Local Group Memberships      *Administrators Global Group memberships     *None 

As you can see, all the details for that user on this computer are listed.

Change When a User Can Log In

 net user rodriguezr /times:M-F,7AM-4PM;Sa,8AM-12PM 

Here's an example where the rodriguezr account is having its login days and times changed.

Make a New User

 net user nadeema r28Wqn90 /add /comment:"Basic user account." /fullname:"Ahmed Nadeem" /logonpasswordchg:yes /workstations:jr7tww,jr2rtw /domain 

We thought we'd throw the kitchen sink at you with this one. This is the kind of net user application you might never do at home, but you might very well see in a script published for a new user by the IT department in a company.

Here, we're setting up a new user account with the name nadeema, and setting the initial password as r28Wqn90. This is a standard account in our company, which we note in the account itself [/comment:"Basic user account."], and is the new Human Resources executive, Ahmed [/fullname:"Ahmed Nadeem"].

We want Ahmed to change his password to something he won't forget, so we want him to set his own the first time he logs on [/logonpasswordchg:yes]. Also, Ahmed should only have access to the two computers in the Human Resources office [/workstations:jr7twwr,jr2rtwb]. Finally, our company uses a domain controller [/domain], so Ahmed's account should be set up there.

As you can see, the net user command is versatile, allowing for more than just adding, changing, and removing user accounts. We configured several advanced aspects of Ahmed's new account directly from Command Prompt.

Delete a User

 net user nadeema /delete 

Now, we'll finish off with an easy one. Ahmed [nadeema] didn't work out as the latest HR member, so he was let go, and his account removed [/delete].

Net User Command Availability

The net user command is available from within the Command Prompt in most versions of Windows including Windows 10, Windows 8, Windows 7, Windows Vista, Windows XP, Windows Server operating systems, and some older versions of Windows, too.

Net User Related Commands

The net user command is a subset of the net command and so is similar to its sister commands like net use, net time, net send, net view, etc.

Was this page helpful?