Net user

Applies To: Windows Server 2003, Windows Server 2003 R2, Windows Server 2003 with SP1, Windows Server 2003 with SP2

Net user

Adds or modifies user accounts or displays user account information.

Syntax

net user [UserName [Password | *] [Options]] [/domain]

net user [UserName {Password | *} /add [Options] [/domain]]

net user [UserName [/delete] [/domain]]

Parameters
  • UserName
    Specifies the name of the user account to add, delete, modify, or view. The name of the user account can have as many as 20 characters.
  • Password
    Assigns or changes a password for the user's account. Type an asterisk (*) to produce a prompt for the password. The password is not displayed when you type it at the password prompt.
  • /domain
    Performs the operation on the domain controller in the computer's primary domain.
  • Options
    Specifies a command-line option. The following table lists valid command-line options that you can use.
<table>
<colgroup>
<col style="width: 50%" />
<col style="width: 50%" />
</colgroup>
<thead>
<tr class="header">
<th>Command-line option syntax</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td><p><strong>/active:</strong>{<strong>no</strong> | <strong>yes</strong>}</p></td>
<td><p>Enables or disables the user account. If the user account is not active, the user cannot access resources on the computer. The default is <strong>yes</strong> (that is, active).</p></td>
</tr>
<tr class="even">
<td><p><strong>/comment:&quot;</strong><em>Text</em><strong>&quot;</strong></p></td>
<td><p>Provides a descriptive comment about the user's account. This comment can have as many as 48 characters. Enclose the text in quotation marks.</p></td>
</tr>
<tr class="odd">
<td><p><strong>/countrycode:</strong><em>NNN</em></p></td>
<td><p>Uses the operating system Country/Region codes to implement the specified language files for a user's Help and error messages. A value of 0 signifies the default Country/Region code.</p></td>
</tr>
<tr class="even">
<td><p><strong>/expires:</strong>{{<em>MM</em><strong>/</strong><em>DD</em><strong>/</strong><em>YYYY</em> | <em>DD</em><strong>/</strong><em>MM</em><strong>/</strong><em>YYYY</em> | <em>mmm</em><strong>,</strong>dd <strong>,</strong><em>YYYY</em>} | <strong>never</strong>}</p></td>
<td><p>Causes the user account to expire if you specify <em>date</em>. Expiration dates can be in [<em>MM</em><strong>/</strong><em>DD</em><strong>/</strong><em>YYYY</em>], [<em>DD</em><strong>/</strong><em>MM</em><strong>/</strong><em>YYYY</em>], or [<em>mmm</em><strong>,</strong>dd <strong>,</strong><em>YYYY</em>] format, depending on the Country/Region code. Note that the account expires at the beginning of the specified date. For the month value, you can use numbers, spell it out, or use a three-letter abbreviation (that is, Jan, Feb, Mar, Apr, May, Jun, Jul, Aug, Sep, Oct, Nov, Dec). You can use two or four numbers for the year value. Use commas or slashes to separate parts of the date. Do not use spaces. If you omit <em>YYYY</em>, the next occurrence of the date (that is, according to your computer's date and time) is assumed. For example, the following entries are equivalent if entered between Jan. 10, 1994, and Jan. 8, 1995:</p>
<p><strong>jan,9</strong></p>
<p><strong>1/9/95</strong></p>
<p><strong>january,9,1995</strong></p>
<p><strong>1/9</strong></p></td>
</tr>
<tr class="odd">
<td><p><strong>/fullname:&quot;</strong><em>Name</em><strong>&quot;</strong></p></td>
<td><p>Specifies a user's full name rather than a user name. Enclose the name in quotation marks.</p></td>
</tr>
<tr class="even">
<td><p><strong>/homedir:</strong><em>Path</em></p></td>
<td><p>Sets the path for the user's home directory. The path must exist.</p></td>
</tr>
<tr class="odd">
<td><p><strong>/passwordchg:</strong>{<strong>yes</strong> | <strong>no</strong>}</p></td>
<td><p>Specifies whether users can change their own password. The default is <strong>yes</strong>.</p></td>
</tr>
<tr class="even">
<td><p><strong>/passwordreq:</strong>{<strong>yes</strong> | <strong>no</strong>}</p></td>
<td><p>Specifies whether a user account must have a password. The default is <strong>yes</strong>.</p></td>
</tr>
<tr class="odd">
<td><p><strong>/profilepath:</strong>[<em>Path</em>]</p></td>
<td><p>Sets a path for the user's logon profile. This path points to a registry profile.</p></td>
</tr>
<tr class="even">
<td><p><strong>/scriptpath:</strong><em>Path</em></p></td>
<td><p>Sets a path for the user's logon script. <em>Path</em> cannot be an absolute path. <em>Path</em> is relative to %<em>systemroot</em>%\System32\Repl\Import\Scripts.</p></td>
</tr>
<tr class="odd">
<td><p><strong>/times:</strong>{<em>Day</em>[<strong>-</strong><em>Day</em>][<strong>,</strong><em>Day</em>[<strong>-</strong><em>Day</em>]]<strong>,</strong><em>Time</em>[<strong>-</strong><em>Time</em>][<strong>,</strong><em>Time</em>[<strong>-</strong><em>Time</em>]][<strong>;</strong>] | <strong>all</strong>}</p></td>
<td><p>Specifies the times that users are allowed to use the computer. <em>Time</em> is limited to 1-hour increments. For the <em>Day</em> values, you can spell out or use abbreviations (that is, M,T,W,Th,F,Sa,Su). You can use 12-hour or 24-hour notation for hours. If you use 12-hour notation, use AM and PM, or A.M. and P.M. The value <strong>all</strong> 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, <strong>M,4AM-5PM;T,1PM-3PM</strong>). Do not use spaces when designating times.</p></td>
</tr>
<tr class="even">
<td><p><strong>/usercomment:&quot;</strong><em>Text</em><strong>&quot;</strong></p></td>
<td><p>Specifies that an administrator can add or change the &quot;User comment&quot; for the account. Enclose the text in quotation marks.</p></td>
</tr>
<tr class="odd">
<td><p><strong>/workstations:</strong>{<em>ComputerName</em>[,...] | <strong>*</strong>}</p></td>
<td><p>Lists as many as eight workstations from which a user can log on to the network. Separate multiple entries in the list with commas. If <strong>/workstations</strong> has no list or if the list is an asterisk (*), users can log on from any computer.</p></td>
</tr>
</tbody>
</table>
  • net help Command
    Displays help for the specified net command.
Remarks
  • Used without parameters, net user displays a list of the user accounts on the computer. You can also type net users.

  • A password must satisfy the minimum length set with net accounts /minpwlen. It can have as many as 127 characters. However, if you are using Windows 2000 or on a network that also has computers using Windows 95 or Windows 98, consider using passwords not longer than 14 characters. Windows 95 and Windows 98 support passwords of up to 14 characters. If your password is longer, you might not be able to log on to your network from those computers.

Examples

To display a list of all user accounts for the local computer, type:

net user

To view information about the user account jimmyh, type:

net user jimmyh

To add a user account for Jay Jamison, with logon rights from 8 A.M. to 5 P.M., Monday through Friday (no spaces in time designations), a mandatory password (jayj), and the user's full name, type:

net user jayj /add /passwordreq:yes /times:monday-friday,8am-5pm/fullname:"Jay Jamison"

To set johnsw's logon time (8 A.M. to 5 P.M.) using 24-hour notation, type:

net user johnsw /time:M-F,08:00-17:00

To set johnsw's logon time (8 A.M. to 5 P.M.) using 12-hour notation, type:

net user johnsw /time:M-F,8am-5pm

To specify logon hours of 4 A.M. until 5 P.M. on Monday, 1 P.M. until 3 P.M. on Tuesday, and 8 A.M. until 5 P.M. Wednesday through Friday for marysl, type:

net user marysl /time:M,4am-5pm;T,1pm-3pm;W-F,8:00-17:00

Formatting legend

Format Meaning

Italic

Information that the user must supply

Bold

Elements that the user must type exactly as shown

Ellipsis (...)

Parameter that can be repeated several times in a command line

Between brackets ([])

Optional items

Between braces ({}); choices separated by pipe (|). Example: {even|odd}

Set of choices from which the user must choose only one

Courier font

Code or program output

See Also

Concepts

Net accounts
Net group
Command-line reference A-Z
Command shell overview

Other Resources

Net services overview
Net localgroup