Some time we want to add new users from command line instead of using the GUI. Example, if we have to add more than 50 users using GUI it will take a lot of time and manual effort. But Windows provides a command called "net user" by which we can add 'n' number of account using a script.
This command is supported on Windows 2000 and above operating system.
Generally System administrators use this command to create and manage 'n' numbers of client in a domain.
Lets see How to use them :-
* To add a new user account on the local computer:
SYNTAX :-
net user username /ADD
Example:
Add a new user account with the username as LMN and with password lmn@123
net user LMN /ADD* To add a new user account on the local computer with password:
SYNTAX :-
net user username password /ADD
Example:
Add a new user account with the username as LMN and with password lmn@123
net user LMN lmn@123 /ADD
* To add a new user account to the domain:
SYNTAX :-
net user username password /ADD /DOMAIN
Example:
net user LMN lmn@123 /ADD /DOMAIN
Few more Advanced uses of net user command
* Enable/Disable a user account.
Activates or deactivates the account. If the account is not active, the user cannot gain access to the server. The default is yes.
SYNTAX :-
Net user username /active:{yes | no}
* Provides a descriptive comment about the user's account
Maximum of 48 characters.
NOTE :- Put quotation marks around the text you use.
SYNTAX :-
Net user username /comment:"text"
* Set Country code.
Uses the operating system country code to implement the specified language files for a user's help and error messages. A value of 0 signifies the default country code.
SYNTAX :-
Net user username /countrycode:nnn* Set Expiry date to a account.
Causes the account to expire if date is set. The never option sets no time limit on the account. An expiration date is in the form mm/dd/yy or dd/mm/yy, depending on the country code. Months can be a number, spelled out, or abbreviated with three letters. Year can be two or four numbers. Use slashes (/) with no spaces to separate parts of the date.
SYNTAX :-
Net user username /expires:{date | never}* Set user full name.
NOTE :- Enclose the name in quotation marks.
SYNTAX :-
Net user username /fullname:"name"* Sets the path for the user's home directory (optional).
SYNTAX :-
Net user username /homedir:pathname* Specifies whether users can change their own password.
The default is yes.
SYNTAX :-
Net user username /passwordchg:{yes | no}* Specifies whether a user account must have a password.
The default is yes.
SYNTAX :-
Net user username /passwordreq:{yes | no}* Sets a path for the user's logon profile (optional).
SYNTAX :-
net user username /profilepath[:path]* Is the location of the user's logon script (optional).
SYNTAX :-
net user username /scriptpath:pathname* Set Account Access time limit.
Is the logon hours. The times option is expressed as day[-day][,day[-day]],time[-time][,time [-time]], and is limited to 1-hour increments. Days can be spelled out or abbreviated. Hours can be 12-hour or 24-hour notation. For 12-hour notation, use am, pm, a.m., or p.m. The all option specifies that a user can always log on, and a blank value specifies that a user can never log on. Separate day and time entries with a comma, and separate multiple day and time entries with a semicolon.
SYNTAX :-
net user username /times:{times | all}* Set a comment for a user.
Lets an administrator add or change the user comment for the account.
SYNTAX :-
net user username /usercomment:"text"* To delete a user account on the local computer.
SYNTAX :-
net user username /delete* To retrieve complete details settings of a user.
SYNTAX :-
Net user username
Example:
C:\>net user LMN
User name LMN
Full Name
Comment
User's comment
Country code 000 (System Default)
Account active Yes
Account expires Never
Password last set 4/21/2014 10:10 PM
Password expires 8/19/2014 10:10 PM
Password changeable 4/21/2014 10:10 PM
Password required Yes
User may change password Yes
Workstations allowed All
Logon script
User profile
Home directory
Last logon Never
Logon hours allowed All
Local Group Memberships *Users
Global Group memberships *None
The command completed successfully.* Displays Help one screen at a time.
You can obtain all of the information contained in this post by typing the following command.
net help user | more* Rename a user account
Net use command don't have any option rename a user account. But we can do that using wmic commands.
Lets see how :-
SYNTAX :-
wmic useraccount where name='currentname' rename newname
Example:
To rename the user account ‘LMN’ as ‘lmntechhnohub’ we can use the below command.
wmic useraccount where name=‘LMN’ rename lmntechhnohub
Using this command we can rename administrator account also. The below command changes the user name from ‘administrator’ to ‘lmntechnohub.’
wmic useraccount where name='administrator' rename lmntechnohub
Enjoy ! and Stay connected.
This command is supported on Windows 2000 and above operating system.
Generally System administrators use this command to create and manage 'n' numbers of client in a domain.
Lets see How to use them :-
* To add a new user account on the local computer:
SYNTAX :-
net user username /ADD
Example:
Add a new user account with the username as LMN and with password lmn@123
net user LMN /ADD* To add a new user account on the local computer with password:
SYNTAX :-
net user username password /ADD
Example:
Add a new user account with the username as LMN and with password lmn@123
net user LMN lmn@123 /ADD
* To add a new user account to the domain:
SYNTAX :-
net user username password /ADD /DOMAIN
Example:
net user LMN lmn@123 /ADD /DOMAIN
Few more Advanced uses of net user command
* Enable/Disable a user account.
Activates or deactivates the account. If the account is not active, the user cannot gain access to the server. The default is yes.
SYNTAX :-
Net user username /active:{yes | no}
* Provides a descriptive comment about the user's account
Maximum of 48 characters.
NOTE :- Put quotation marks around the text you use.
SYNTAX :-
Net user username /comment:"text"
* Set Country code.
Uses the operating system country code to implement the specified language files for a user's help and error messages. A value of 0 signifies the default country code.
SYNTAX :-
Net user username /countrycode:nnn* Set Expiry date to a account.
Causes the account to expire if date is set. The never option sets no time limit on the account. An expiration date is in the form mm/dd/yy or dd/mm/yy, depending on the country code. Months can be a number, spelled out, or abbreviated with three letters. Year can be two or four numbers. Use slashes (/) with no spaces to separate parts of the date.
SYNTAX :-
Net user username /expires:{date | never}* Set user full name.
NOTE :- Enclose the name in quotation marks.
SYNTAX :-
Net user username /fullname:"name"* Sets the path for the user's home directory (optional).
SYNTAX :-
Net user username /homedir:pathname* Specifies whether users can change their own password.
The default is yes.
SYNTAX :-
Net user username /passwordchg:{yes | no}* Specifies whether a user account must have a password.
The default is yes.
SYNTAX :-
Net user username /passwordreq:{yes | no}* Sets a path for the user's logon profile (optional).
SYNTAX :-
net user username /profilepath[:path]* Is the location of the user's logon script (optional).
SYNTAX :-
net user username /scriptpath:pathname* Set Account Access time limit.
Is the logon hours. The times option is expressed as day[-day][,day[-day]],time[-time][,time [-time]], and is limited to 1-hour increments. Days can be spelled out or abbreviated. Hours can be 12-hour or 24-hour notation. For 12-hour notation, use am, pm, a.m., or p.m. The all option specifies that a user can always log on, and a blank value specifies that a user can never log on. Separate day and time entries with a comma, and separate multiple day and time entries with a semicolon.
SYNTAX :-
net user username /times:{times | all}* Set a comment for a user.
Lets an administrator add or change the user comment for the account.
SYNTAX :-
net user username /usercomment:"text"* To delete a user account on the local computer.
SYNTAX :-
net user username /delete* To retrieve complete details settings of a user.
SYNTAX :-
Net user username
Example:
C:\>net user LMN
User name LMN
Full Name
Comment
User's comment
Country code 000 (System Default)
Account active Yes
Account expires Never
Password last set 4/21/2014 10:10 PM
Password expires 8/19/2014 10:10 PM
Password changeable 4/21/2014 10:10 PM
Password required Yes
User may change password Yes
Workstations allowed All
Logon script
User profile
Home directory
Last logon Never
Logon hours allowed All
Local Group Memberships *Users
Global Group memberships *None
The command completed successfully.* Displays Help one screen at a time.
You can obtain all of the information contained in this post by typing the following command.
net help user | more* Rename a user account
Net use command don't have any option rename a user account. But we can do that using wmic commands.
Lets see how :-
SYNTAX :-
wmic useraccount where name='currentname' rename newname
Example:
To rename the user account ‘LMN’ as ‘lmntechhnohub’ we can use the below command.
wmic useraccount where name=‘LMN’ rename lmntechhnohub
Using this command we can rename administrator account also. The below command changes the user name from ‘administrator’ to ‘lmntechnohub.’
wmic useraccount where name='administrator' rename lmntechnohub
Enjoy ! and Stay connected.
0 comments :
Post a Comment