Net User Command (Examples, Options, Switches, & More)

'Net User' command examples, options, switches, and more

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.

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

Person using the Net User command on a computer
Lifewire / Derek Abella 

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.

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

Net User Command Syntax

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

See How to Read Command Syntax if you're not sure how to read the net user command syntax explained above or in the table below.

Net User Command Options
Item 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 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.

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

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

Additional Net User Command Options
Item Explanation
/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 on. 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 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.

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

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

Net User Command Examples

This first example of the net user command shows that at its simplest form, 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.

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.

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.

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 can be used for a lot more than simple user account adds, changes, and removals. We configured several advanced aspects of Ahmed's new account right from Command Prompt.

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 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?