Managing user account and groups with “net” command line. The Net user command line is a built-in Windows Command tool. It uses for creating, deleting and managing user account in Windows operating system. Managing user account using command line and graphical interface both are easy. But the command line is high-speed and powerful. The net command utility works on command prompt and PowerShell.
To learn more about Powershell, just read the PowerShell articles on technig.com. And let’s start managing user account with a command line.
Managing user account using command line in Windows 10:
- Net user command review.
- Add a user account with command.
- Set Password to a user account with command.
- Change user account password using a command line.
- Upgrade standard user to an Administrator account.
- Delete a user account and profile with command.
To run net user command, open command prompt or PowerShell with typing “cmd” on Windows Run.
- Press Windows+R to open the run.
- Type “cmd” and press enter for command prompt. And for Powershell just type “Powershell.”
- Now, type “net user /?” and press enter to see the net user command line help.
Note: If you want to execute net user to add a new user or bring changes, you must run cmd or Powershell as administrators. It does not work as standard users. To run them as an administrator, just press Windows and search Powershell then press Shift+Ctrl and press enter.
Managing User Account using Command Line
To understand the structures of a command prompt command, get the help by typing “/?” at the end of any command on command prompt and PowerShell. It will show you the help documents.
PS C:\> net user /? The syntax of this command is: NET USER [username [password | *] [options]] [/DOMAIN] username {password | *} /ADD [options] [/DOMAIN] username [/DELETE] [/DOMAIN] username [/TIMES:{times | ALL}] username [/ACTIVE: {YES | NO}] PS C:\>
Add a New User Account with Command Line
Let’s start and create a new user account with the net user command, named Ali with Password 123, and press enter. Type the following command to add a new user account with the command line in Windows 10.
PS C:\> net user ali 123 /add The command completed successfully. PS C:\>
The user Ali has been created successfully. If it shows the Access denied error, it means that the command prompt is running as standard users, like below error.
PS C:\Users\Shais> net user Ali 123 /add System error 5 has occurred. Access is denied.
To view the complete information for a newly created user account, just type “net user Ali” and press enter. It will show you the user local group membership, Global group membership, date of creation, etc.
PS C:\> net user ali User name ali Full Name Comment User's comment Country/region code 000 (System Default) Account active Yes Account expires Never Password last set 10/10/2017 9:12:47 PM Password expires 11/21/2017 9:12:47 PM Password changeable 10/10/2017 9:12:47 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. PS C:\>
Set Password to User Account with command
To set a password to a user account or changing the password of a user account, type “net user Ali *” command then press enter and type the new password twice.
PS C:\> net user Ali * Type a password for the user: Retype the password to confirm: The command completed successfully. PS C:\>
You can use this method to change any user account password in Windows 10 and other Windows operating systems.
Change Standard User to Administrator in Windows 10
You have successfully created a new standard user account and now try to add this user account to an Administrators group. The administrator privilege gives you the ability to bing changes to Windows 10 system and settings. With a standard user account, you cannot run the command, install software and change Windows settings. To change standard user to Administrator in Windows 10, just type the following command.
On the user information, you saw that Ali was only a member of the Users group, a standard group. You can add a user account to a group with “Net Localgroup” command.
PS C:\> net localgroup administrators ali /add The command completed successfully. PS C:\>
To remove a user group membership, type the following command and press enter
PS C:\> net localgroup administrators ali /delete The command completed successfully. PS C:\>
Delete a User account with Net User Command
If you don’t need a user account anymore, don’t leave it away. Delete or disable it for security reasons. Someone might crack the password and log in to your system. To delete a user type “net user Ali /delete” command.
PS C:\> net user ali /delete The command completed successfully. PS C:\>
Note: When you remove a user with a net user command line, the profile’s deleted user account remains in the user profiles folder. You must delete it manually from the user profile setting. Read this article “Remove User Profile correctly in Windows 10“.
I hope you find the article managing user account using command line in Windows 10 helpful. If you have any problem or question about the managing user account using command line feel free and ask through comment. If you don’t like to use command line, try to read the article about creating a user account with a graphical interface in Windows 10.
Thank you this comprehensive and detailed guide.