Home » PowerShell Tips » Net User – Create Local User using CMD Prompt

Net User – Create Local User using CMD Prompt

Net User command-line tool used to add or modify user accounts, and manage user groups in Windows. I will explain how to create a local user account using the net user command-line tool using the cmd prompt on a Windows computer.

net user create local user admin
Using the net user to create a local user admin

In this article, I will explain using net user in the cmd prompt to create a local user account with a password on a Windows computer.

Net User Create Account with Password

If you want to create a local user account with a password from the command line, follow the below steps:

Open Command Prompt

Click Start –> Search cmd –> open Command Prompt with Run as Administrator

Type the Net User command

net user syntax to add a new user with a password as below

net user /add username password

To add a new user account with a password, type the above net user syntax in the cmd prompt

net user /add adam ShellTest@123
The command completed successfully.

If you want to add a new user account with a password but without displaying a password on the screen, use the below syntax

net user /add username *

In the above net user the command-line tool, * after username prompt for a user to type password and retype the password for confirmation.

Let’s see with below example,

net user /add nathan *
Type a password for the user:
Retype the password to confirm:
The command completed successfully.

Cool Tip: How to fix the trust relationship between the workstation and the primary domain!

Net User Show all Users

If you want to display all users of a local computer system, use net user the command-line tool to show all users as below

C:\Windows\system32>net user

User accounts for \\ENGG-PRO

-------------------------------------------------------------------------------
adam                     chrisd                   ErickJ
garyw                    Guest                    krbtgt
Tesadmin                 nathan                   toms
The command completed successfully.

Cool Tip: How to use Get-AdDomainController to get domain controller in PowerShell!

Net User Add Full Name

We have seen above to create a new user in window computer using net user. If you want to add a full name for a user account, use the below syntax.

net user username /fullname:"add full name"

In the above syntax, net user command is used to manage a user account on a Windows computer.

/FullName – Use this net user switch to provide the full name for a user account.

Run the below command to add user full name using net user /fullname

net user adam /fullname:"Adam Strauss"
The command completed successfully.

Net User Create Local Admin User

If you want to create a local admin user or add an existing user to the local administrator group, use the below syntax.

net localgroup groupname user /add

use net localgroup command to add a user to a specified groupname.

For example, if you want to add user ‘adam’ created above to the administrator group, run the below command

net localgroup administrators adam /add
The command completed successfully.

In the above example, the net user adds user to the administrator group.

Cool Tip: How to find active directory groups I’m in using PowerShell!

Net User to Add Domain User to Local Group

If you have a requirement to add a domain user to a local group of administrators, use the below net localgroup syntax.

net localgroup users domainname\username /add

For example, if you have a computer connected to a network system and have a requirement to add a domain user to a local group of administrators, run the below command.

net localgroup administrators SHELLPRO\adam /add

The above command will add a domain user to the local administrator group.

If you want to add a user to the remote desktop users group, run the below command

net localgroup "Remote Desktop Users" Adam  /add

The above net command uses a localgroup parameter that adds user “Adam” to the “Remote Desktop Users” group using /add option.

If you want to add a user to the Power Users group, run the below command.

net localgroup "Power Users" Adam /add

In the above script, the net localgroup command line tool adds user ‘Adam‘ to the “Power Users” group.

If you want to display all local group administrators on a local computer system, run the below command

net localgroup administrators

In the above net localgroup command the list of all users belonging to the administrators group.

C:\Windows\system32>net localgroup administrators
Alias name     administrators
Comment        Administrators have complete and unrestricted access to the computer/domain

Members

-------------------------------------------------------------------------------
adam
Domain Admins
Enterprise Admins
admin
The command completed successfully.

Cool Tip: How to get-aduser in the active directory using PowerShell!

Conclusion

In the above article using a net user to create a new user account with a password, the net user adds the full name of the user account and manages user accounts on the local computer.

Cool Tip: How to command prompt restart the windows using cmd!

You can find more topics about PowerShell Active Directory commands and PowerShell basics on the ShellGeek home page.

Leave a Comment