Home NT Commands
NT Syntax

NET USER options

The NET Command is used to manage network resources as follows:

options are as follows:

/active:{no | yes}
Enable or disable the user account.
The default is yes (login is allowed)
Disabling an account does not immediately log off any user sessions.

/comment:"text"
A descriptive comment (48 characters).

/countrycode:nnn
Use the OS country codes to implement specified language files for help and error messages. 0 = default country code.

/expires:{date | never}
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).

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

/homedir:path
The path for the user's home directory. The path must exist.

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

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

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

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

/scriptpath: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.

/times:{times | all}
The times the user is allowed to use the computer.
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.

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

/workstations:{computername[,...] | *}
List as many as eight workstations from which a user can log on to the network.
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

NET USER jbloggs apass /ADD /fullname:"Joe Bloggs" /scriptpath:logon.cmd

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

NET USER fred_bloggs /HOMEDIR:\\Server_05\ /PROFILEPATH:\\Server_05\D$\USERS\fred_bloggs /DOMAIN


"The only real way to look younger is not to be born so soon." - Charles Schulz

Related commands:

CON2PRT
- Connect or disconnect a Printer
GLOBAL - Display membership of global groups
LOCAL
- Display membership of local groups
MODE - Configure a system device
NETDOM - Domain Manager
SC - Service Control

Q149427 - Change Password from the CMD prompt

Equivalent Linux BASH commands:

groups - Print group names a user is in
id - Print user and group id's
logname - Print current login name
uname - Print system information
users - Print login names of users currently logged in



Simon Sheppard
SS64.com