In the previous article we reviewed how to obtain information about a network user with the net user / domain command, but we must bear in mind that this command has many more utilities and can be used to perform many tasks related to the administration of users through the command line. These are actions that we could perform from the active directory or from a remote computer administration, but with the advantage that we do not need to have anything installed.
- net user Usernamepassword: With this command you set the key «password» for the user local user «user».
- net user user password / domain: With this command you set the key «password» for the user network user «user». This command is only valid for Windows NT Server domains.
- net user Username *: Once this command has been entered, the system will ask to enter a password for the local user «user». Keep in mind that the entered password will not appear on the screen.
- net user Username * / domain: With this command the system asks to enter a password for the network user «user». Note that the entered password is not displayed on the screen.
- net user Usernamepassword / add: With this command the system creates a local user with the name «user» and with the password «password».
- net user Username * / add: With this command the system creates a local user with the name «user» and asks to assign a password to it.
- net user Usernamepassword / add/ domain: It is the same command as the one mentioned 2 points above, but in this case the user created instead of being local is a network user.
- net user Username*/ add/ domain: Idem, but in this case it asks to set a password.
- net user Username*/ delete: Removes the local user "user".
- net user Username*/ delete / domain: Deletes the network user "user".
In addition to these options, the net user command has many more variables. These are the ones that I find the most interesting (remember to put the tag «/ domain» at the end of each command if you want to execute it on a network user):
- net user Username / active: yes: Activates the user account «user». If instead of "yes" you write "no" ... it is disabled.
- net user Username / expires: dd / mm / yy: The local user's password expires on the date mm / dd / yy. If instead of indicating the date you write "never" the key never expires.
- net user Username / homedir: path : It is used to indicate to the system in which path the user's home directory "user" is established. It is necessary that the indicated route really exists.
- net user Username / passwordchg: no:The user "user" cannot change his password. If you indicate "yes" it means you can change it.
- net user Username / passwordreq: no : It is not necessary for the user "user" to have a password.
- net user Username / profilepath [: path] :It is used to set the folder where the login profile of the user «user» is loaded.
- net user Username / scriptpath:route : In this way, the system is told that it has to execute the script that appears in the path «path» for the user «user».
- net user Username / times: all : Specifies the hours that the user "user" can log in. If you indicate "there" it means that you can log in to the computer at any time. On the other hand, if you leave the value blank, it will block access whatever time it is. If you want to indicate a space of time, you must indicate it with the format "day", "hour" to separate the hour and the day and a semicolon to separate several days and hours.
- net user Username / workstations: *
The user can log in to all computers on the network. If you specify the team names in brackets [,] and separated by commas, you can assign up to a maximum of eight teams.