NET USER - Windows CMD

The NET command is used to manage user accounts and groups.

Syntax
      NET USER username {password | *} /ADD [options] [/DOMAIN]

      NET USER [username [password | *] [options]] [/DOMAIN]

      NET USER username [/DELETE] [/DOMAIN]

      NET USER username [/TIMES:{times | ALL]

      NET USER username [/ACTIVE: {YES | NO}]

      Generate a random password:
      NET USER username /random

Options

   Enable or disable the user account. The default is yes (login is allowed).
   Disabling an account does not immediately log out any user sessions.

   NET USER... /active:{no | yes}  

   Add a descriptive comment (48 characters):

   NET USER... /comment:"text"
   
   Use the OS country codes to implement specified language files for help and 
   error messages. 0 = default country code.

   NET USER... /countrycode:nnn

   Cause the user account to expire. date can be in mm/dd/yy, dd/mm/yy, or mmm,dd,yy 
   format, depending on the /countrycode. Months can be a number, spelled out, 
   or abbreviated with three letters. Use commas or slashes to separate parts of 
   the date (no spaces).
   NET USER... /expires:{date | never}

   The user’s full name (rather than a username):
   NET USER... /fullname:"name"

   The path for the user’s home directory. The path must exist.
   NET USER... /homedir:path

   Is a home directory required?
   NET USER... /homedirreq:{yes | no}

   Can users change their own password? The default is yes.
   NET USER... /passwordchg:{yes | no}

   Must a user account have a password? The default is yes.
   /passwordreq:{yes | no}

   The path for the user’s logon profile.
   This pathname will be used to store their registry profile.
   NET USER... /profilepath:[path]

   Path for the user’s logon script. This is relative to %systemroot%\SYSTEM32\REPL\IMPORT\SCRIPTS. 
   (The NETLOGON share) You can’t use an absolute path.
   NET USER... /scriptpath:path

   The times the user is allowed to use the computer.
   NET USER... /times:{times | all}

      The times value is expressed as day[-day][,day[-day]] , time[-time][,time[-time]], 
      limited to 1-hour time increments.

      Days can be spelled out or abbreviated (M,T,W,Th,F,Sa,Su).

      Hours can be 12- or 24-hour notation. For 12-hour notation, use AM, PM, or A.M., P.M.

      The value all means a user can always log on.

      A null value (blank) means a user can never log on.

      Separate day and time with commas, and units of day and time with semicolons 
      (for example, M,4AM-5PM;T,1PM-3PM).

      Do not use spaces when designating /times.

   Add or change the "User comment" for the account. Only Administrators can edit this.
   NET USER... /usercomment:"text"

   List as many as eight workstations from which a user can log on to the network.
   NET USER... /workstations:{computername[,...] | *}

   Separate multiple entries in the list with commas.
   If /workstations has no list, or if the list is *, the user can log on from any computer.

Examples

Add the user 'user64' and set a password and logon script:

NET USER user64 Secr3tpassword /ADD /fullname:"Jessye Pine" /scriptpath:logon.cmd

Add the user 'alice_smith' and add a comment:

NET USER alice_smith /ACTIVE:yes /comment:"RAS User" /DOMAIN

Add the user 'student102' and add a password and profile path:

NET USER student102 Secr3t /HOMEDIR:\\Server05\ /PROFILEPATH:\\Server05\D$\USERS\student102 /DOMAIN

View the user account details of the alice_smith domain user account:

NET USER alice_smith /DOMAIN

Change the password of a local user account:

NET USER LocalUser64 Secr3t

View the password properties of user account 'user64', this will show if the account requires a password:

NET USER user64 | findstr "Password"

Change the properties of user account 'user64' to make the password not required. To reverse this, change 'false' to 'true':

WMIC useraccount where name='user64' set PasswordRequired=false

Related commands

Q324639 - NET.EXE /ADD does not support names longer than 20 characters.
NET.exe - Manage network resources.
NTRIGHTS - Edit user account rights (Logon Locally etc).
DSADD - Add user (computer, contact, group..) to active directory.
WMIC USERACCOUNT - WMI access to User info.
Q149427 - Change Password using the Settings app.
PowerShell: Set-LocalUser - Modify a local user account  / Set-ADUser - Modify an AD user /  New-ADUser - Create a new AD user / Set-adAccountPassword - Modify the password of an AD account.
Equivalent bash command (Linux): useradd - Add user account.


Copyright © 1999-2026 SS64.com
Some rights reserved