The net user and group commands are very powerful tools for managing local and domain users and groups.
In this post, I will show you how to use the net user
command locally and on a domain to create a user account, reset a user account password, and view general info about a user account. I will also show you how to use the net group
and net localgroup
commands to manage local groups and domain groups, and how to view group members.
Net User
Create User Account
- Open CMD as admin or as an account that can create a domain user account.
New Local User
- Enter the following command to create a new local user account and replace USERNAME_HERE and PASSWORD_HERE with the username and password you would like to use
net user USERNAME_HERE PASSWORD_HERE /add
For example, if I want to make a new local account named NewUser with a password of NewP@ssword1, the command will be net user NewUser NewP@ssword1 /add
New Domain User
- Enter the following command to create a new domain user account and replace USERNAME_HERE and PASSWORD_HERE with the username and password you would like to use
net user USERNAME_HERE PASSWORD_HERE /add /domain
For example, if I want to make a new domain user account named NewUser1 with a password of NewP@ssword1, the command will be net user NewUser1 NewP@ssword1 /add /domain
Change User Password
- Open CMD as admin or as an account that can change a domain user password.
Change Local User Password
- Enter the following command to change a local user account’s password and replace USERNAME_HERE and PASSWORD_HERE with the username and password you would like to use
net user USERNAME_HERE PASSWORD_HERE
For example, if I want to change the password of the local account named NewUser to the password of NewP@ssword2, the command will be net user NewUser NewP@ssword2
Change Domain User Password
- Enter the following command to change a domain user account’s password and replace USERNAME_HERE and PASSWORD_HERE with the username and password you would like to use
net user USERNAME_HERE PASSWORD_HERE /domain
For example, if I want to change the password of a domain account named NewUser1 to the password of NewP@ssword2, the command will be net user NewUser1 NewP@ssword2 /domain
View User Details
- Open CMD as admin or as an account that can view domain user info.
View Local User Details
- Enter the following command to view information about a local user account and replace USERNAME_HERE with the local user account you want to view the info of
net user USERNAME_HERE
For example, if I want to view info about the local user account named NewUser, the command will be net user NewUser
View Domain User Details
- Enter the following command to view information about a domain user and replace USERNAME_HERE with the domain user account you want to view the info of
net user USERNAME_HERE /domain
For example, if I want to view info about the domain user account named test, the command will be net user test /domain
Net Group
Add User to a Group
- Open CMD as admin or as an account that can modify domain groups.
Add User to Local Group
- Enter the following command to add a user to a local group and replace LOCAL_GROUP_HERE and USERNAME_HERE with the username and local group name
net localgroup LOCAL_GROUP_HERE USERNAME_HERE /add
For example, if I want to add the account named NewUser to the local Administrators group, the command will be net localgroup Administrators NewUser /add
Another example is if I want to add the account named NewUser to the local Remote Desktop Users group, the command will be net localgroup "Remote Desktop Users" NewUser /add
Remove User from Local Group
- Enter the following command to remove a user from a local group and replace LOCAL_GROUP_HERE and USERNAME_HERE with the username and local group name
net localgroup LOCAL_GROUP_HERE USERNAME_HERE /delete
For example, if I want to remove the account named NewUser from the local Administrators group, the command will be net localgroup Administrators NewUser /delete
Another example is if I want to remove the account named NewUser from the local Remote Desktop Users group, the command will be net localgroup "Remote Desktop Users" NewUser /delete
Add User to Domain Group
- Enter the following command to add a user to a domain group and replace DOMAIN_GROUP_HERE and USERNAME_HERE with the username and domain group name
net group DOMAIN_GROUP_HERE USERNAME_HERE /add /domain
For example, if I want to add the domain user account named NewUser1 to the domain group named Domain Admins, I will run the following command net group "Domain Admins" NewUser1 /add /domain
Remove User from Domain Group
- Enter the following command to remove a user from a domain group and replace DOMAIN_GROUP_HERE and USERNAME_HERE with the username and domain group name
net group DOMAIN_GROUP_HERE USERNAME_HERE /delete /domain
For example, if I want to remove the domain user account named NewUser1 from the domain group named Domain Admins, I will run the following command net group "Domain Admins" NewUser1 /delete /domain
View Group Details
- Open CMD as admin or as an account that can view domain group info.
View Local Group Members
- Enter the following command to view the members of a local group and replace LOCAL_GROUP_HERE with the local group name
net localgroup LOCAL_GROUP_HERE USERNAME_HERE
For example, if I want to view the members of the local Administrators group, the command will be net localgroup Administrators
Another example is if I want to view the members of the local Remote Desktop Users group, the command will be net localgroup "Remote Desktop Users"
View Domain Group Members
- Enter the following command to view the members of a domain group and replace DOMAIN_GROUP_HERE with the domain group name
net group DOMAIN_GROUP_HERE /domain
For example, if I want to view the members of the domain group named Domain Admins, I will run the following command net group "Domain Admins" /domain
Another example is if I want to view the members of the domain group named Domain Controllers, I will run the following command net group "Domain Controllers" /domain
Summary
That covers how to manage users and groups using the net command. I find myself using the commands pretty often when troubleshooting or completing setups.
If you want to read more about the Net command, here is the Microsoft documentation.