Some times we may want to add new users from command line instead of
using the UI. For example, if we have to add some 100 users, using a
script will save lot of time and manual effort. Windows provides net
user command for this purpose. This command works on Windows 2000,
Windows XP/2003, Vista and Windows 7.
To add a new user account on the local computer:
To add a new user account to the domain:
Example:
Rename a user account
Net use command does not have any switches to rename a user account. But we can do that using wmic commands. Please check this – Rename user accounts on Windows
Few more Advanced uses of net user command.
To set user full name while creating the user account
To specify if the user must have a password set we can use /PASSWORDREQ switch.
To add a new user account on the local computer:
net user username password /ADD
Example: To add a new user account with the loginid John and with password fadf24asnet user John fadf24as /ADD
To add a new user account to the domain:
net user username password /ADD /DOMAIN
Note that the command does not include the domain name.Example:
net user John fadf24as /ADD /DOMAIN
Rename a user account
Net use command does not have any switches to rename a user account. But we can do that using wmic commands. Please check this – Rename user accounts on Windows
Few more Advanced uses of net user command.
To set user full name while creating the user account
net user username password /ADD /FULLNAME:"User_Fullname"
To allow user to change password:net user username password /ADD /PASSWORDCHG:Yes
To restrict user not to change the password:net user username userpasswd /ADD /PASSWORDCHG:NO
To set account expiry time we can use /EXPIRES switch. This can also be used to set that the account never expires.To specify if the user must have a password set we can use /PASSWORDREQ switch.
Nessun commento:
Posta un commento