Net User Command

Net User Command Examples, Switches, & More

Screenshot of the net user command in Windows 10
Net User Command (Windows 10).

What is the Net User Command?

The net user command is used to add, remove, and make changes to the user accounts on a computer, all from the Command Prompt.

The net user command is one of many net commands.

Note: You can also use net users in place of the net user. They're completely interchangeable.

Net User Command Syntax

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

Tip: See How To Read Command Syntax if you're not sure how to read the net user command syntax above.

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 modify an existing password or assign one when creating a new username. The minimum characters required can be viewed using the net accounts command. A maximum of 127 characters is allowed1.

* = You also have the option of using * in place of a password to force the entering of a password 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.

Additional Net User Command Options

The following options are to be used where I note options in the net user command syntax above:

/active:{yes | no} = Use this switch to active or deactivate the specified useraccount. If you don't use the /active option, the net user assumes 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 = This switch is used to set a country code for the user, which determines the language used for error and help messages. If the /countrycode switch isn't used, the computer's default country code is used: 000.

/expires:{date | never} = The /expires switch is used to set a specific date (see below) in which 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 /passwordchg is not used, the net user assumes yes.

/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. If you don't use /times then net user assumes that all times are okay. 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 computer names 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.

Tip: You can store the output of whatever is shown on screen after running the net user command by using a redirection operator with the command. See How To Redirect Command Output to a File for instructions.

Net User Command Examples

net user administrator

In this example, the net user 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 code                 000 (System Default)
Account active               No
Account expires              Never

Password last set            7/13/2009 9:55:45 PM
Password expires             Never
Password changeable          7/13/2009 9:55:45 PM
Password required            Yes
User may change password     Yes

Workstations allowed         All
Logon script                 
User profile                 
Home directory               
Last logon                   7/13/2009 9:53:58 PM

Logon hours allowed          All

Local Group Memberships      *Administrators       *HomeUsers            
Global Group memberships     *None

As you can see, all the details for the administrator account on my Windows 7 computer are listed.

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

Here's an example where I, presumably someone responsible for this user account [rodriguezr], make a change to the days and times [/times] that this account is able to log on to Windows: Monday through Friday [M-F] from 7:00am to 4:00pm [7AM-4PM] and on Saturday [Sa] from 8:00am to noon [8AM-12PM].

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

I thought I'd throw the kitchen sink at you with this example. This is the kind of net user application that 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 I'm setting up a new user account [/add] with the name nadeema and setting the initial password as r28Wqn90. This is a standard account in my company, which I note in the account itself [/comment:"Basic user account."], and is the new human resources executive, Ahmed [/fullname:"Ahmed Nadeem"].

I want Ahmed to change his password to something he won't forget, so I 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, my company uses a domain controller [/domain] so Ahmed's account should be setup there.

As you can see, the net user can be used for a lot more than simple user account adds, changes, and removals. I configured several advanced aspects of Ahmed's new account right from the Command Prompt.

net user nadeema /delete

And 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 10Windows 8, Windows 7, Windows Vista, Windows XP, Windows Server operating systems, and some older versions of Windows too.

Note: The availability of certain net user command switches and other net user command syntax may differ from operating system to operating system.

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.

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

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