May 23, 2022

On our Windows computer it is possible to create, delete and manage user accounts from the system configuration page itself. However, it is also possible to manage system user accounts from a Command Prompt window via the command line. To do this, we are going to use the command called NetUserabout which we are going to talk to you today that will allow us to manage Windows 10 and Windows 11 user accounts in this way.

The Net User command line is extremely useful when it comes to managing user accounts in Windows 10 and Windows 11 as we will be able to perform numerous actions with this command, such as adding a new user account or changing the password of an existing account, etc, as we will see below.

What is NetUser

NetUser is a command line tool which is available for both Windows 10 and Windows 11, through which it allows us to display information about the user accounts of the system, make some changes to them in a simple way and even activate the inactive administrator account of the system. That is why through this command we can add, delete or modify user accounts.

It is a tool mainly used by system administrators, who usually access the operating system through SSH and execute different commands in the console. But the endless possibilities of this tool are not limited to just the uses mentioned above.

Since this is an administrator account command line tool, it can be used both from the Symbol of the system as from PowerShell when run as administrator. To open it from Command Prompt, just type CMD in the Start menu search box and click “Run as administrator”.

Uses of the Net User command

The use of Net User does not have many complications as we will see below. If we run it from the Command Prompt without any arguments behind it, it will take care of showing us a list with all users that we have created in our operating system.

NetUser

Net User list of users

If you see a user account with the name WDAGUtilityAccount we should not worry, since this account is part of Windows Defender Application Guard and provides additional security to our computer, against malicious attacks, when we browse the Internet.

basic commands

Net User supports many parameters, but there are some that you might use more often than others.

  • Net User username: This command lists detailed information about the user that we specify. This includes information such as last login, local group membership, and password information.

net user username password /add

To add the user with password we need to replace the “username” part of the command line with the name you want to give to the account and the “password” with a password that will be used to log in to the account.

  • Net User username password: Sets the password for the user account.

net user username password

To change the password of a user account we replace “username” with the username and “password” with the password that we want to establish

  • Net User username /delete: Delete the user and everything related to its configuration. The changes made are not reversible.

net user username /delete

To remove a user we must replace the “username” in the command line with the user account you want to remove from your computer.

  • Net User username /active:yes|no: Activate the account so that it can be used. In case of establishing it, it does not deactivate the account.
  • Net User username password /add: creates a new user in the system, incorporates the new username and the password that we want that user to have in particular.

Net User Command Syntax

The command syntax seems confusing at first glance, as it shows various commands you can run when you run its helper command which will show us all the commands that are available, along with what each one does. To do this, type the following command and press Enter:

net user /help

net user help

This will show us the correct syntax, options and functions available with this tool.

NET USER
[usuario [contraseña | *] [opciones]] [/DOMAIN]

user {password | *} /ADD [opciones] [/DOMAIN]

Username [/DELETE] [/DOMAIN]

Username [/TIMES:{tiempos | ALL}]

Username [/ACTIVE: {YES | NO}]

  • User: name of the user account you want to add, delete, modify or view. The user account name can be up to 20 characters long.
  • Password: Assign or change the password for the user account. Passwords must meet the minimum length set with the /MINPWLEN option on the NET ACCOUNTS command, and can be up to 14 characters.
  • * (asterisk): creates a password request. The password will not be displayed while it is being typed.
  • /DOMAIN: Performs the operation on a domain controller in the current domain.
  • /ADD: Adds a user account to the user account database.
  • /DELETE: Removes a user account from the user account database.

Other commands of interest

This help command also shows us other interesting options that we can carry out with Net User:

  • /COMMENT:»text»: provides a descriptive comment about the user account. Write a text between quotes.
  • /COUNTRYCODE:nnn: uses the country/region code of the operating system to use the language files specified in the help and error messages for the user. A value of 0 indicates the default country/region code.
  • /EXPIRES:{date | NEVER}: causes the account to expire if a date is set. NEVER does not set a time limit on the account. The expiration date must be in the format mm/dd/yy(yy). Months can be indicated by numbers, names, or three-letter abbreviations. The year must contain 2 or 4 numbers. Use forward slashes (/) instead of spaces to separate parts of the date.
  • /FULLNAME:»name»: full name of the user (as opposed to a username). Enclose the name in quotation marks.
  • /HOMEDIR:path: sets the path to the user’s home directory. The path must exist.
  • /PASSWORDCHG:{YES | NOT}: specifies whether users can change their password. The default value is YES.
  • /PASSWORDREQ:{YES | NOT}: specifies whether a user account must have a password. The default value is YES.
  • /LOGONPASSWORDCHG:{YES|NO}: specifies whether the user must change their own password at the next login. The default option is NO.
  • /PROFILEPATH[:ruta]: sets a path for the user’s login profile.
  • /SCRIPTPATH:path: location of the user’s login script.
  • /TIMES:{times | ALL}: login hours. TIMES is expressed as day[-día][,día[-día]],time[-hora][,hora [-hora]], limited to 1-hour increments. The days can be written in full or abbreviated. Hours can be expressed in 12-hour or 24-hour notation. Use am, pm, amo pm for 12-hour notation. ALL indicates that a user can always log in, and a blank value indicates that they can never log in. Separate day and hour values ​​with commas, and separate multiple day and hour values ​​with semicolons.
  • /USERCOMMENT:»text»: allows an administrator to add or change the user comment for the account.
  • /WORKSTATIONS:{team [,…] | *}: displays up to 8 computers on the network from which a user will be able to log on. If /WORKSTATIONS has no list or if list is *, the user will be able to connect from any computer.

As we can see, Net User is an extremely interesting command to be able to manage and configure user accounts in Windows 10 and Windows 11. With its use we can create, modify, delete, add passwords and many other interesting and useful parameters.