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. |
[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.
Thanks for letting us know!
Subscribe
Tell us why!
Leave a Comment
Your email address will not be published. Required fields are marked *