Add User To Group From Command Line (CMD)
Maybe your like
Windows provides command line utilities to manager user groups. In this post, learn how to use the command net localgroup to add user to a group from command prompt’
Add user to a group
Run the steps below –
- Open elevated command prompt
- Run the below command net localgroup group_name UserLoginName /add
For example to add a user ‘John’ to administrators group, we can run the below command.
net localgroup administrators John /add
Few more examples:
To add a domain user to local users group:
net localgroup users domainname\username /addThis command should be run when the computer is connected to the network. Otherwise you will get the below error.
H:\>net localgroup users domain\user /add System error 1789 has occurred. The trust relationship between this workstation and the primary domain failed.To add a domain user to local administrator group:
net localgroup administrators domainname\username /addTo add a user to remote desktop users group:
net localgroup "Remote Desktop Users" UserLoginName /addTo add a user to debugger users group:
net localgroup "Debugger users" UserLoginName /addTo add a user to Power users group:
net localgroup "Power users" UserLoginName /addThis command works on all editions of Windows OS i.e Windows 2000, Windows XP, Windows Server 2003, Windows Vista and Windows 7. In Vista and Windows 7, even if you run the above command from administrator login you may still get access denied error like below.
C:\> net localgroup administrators techblogger /add System error 5 has occurred. Access is denied.The solution for this is to run the command from elevated administrator account. See How to open elevated administrator command prompt
When you run the ‘net localgroup’ command from elevated command prompt:
C:\>net localgroup administrators techblogger /add The command completed successfully.To list the users belonging to a particular group we can run the below command.
net localgroup group_nameFor example to list all the users belonging to administrators group we need to run the below command.
net localgroup administratorsRelated posts:
Add new user account Delete user account
Tag » Add Computer To Ad Group Cmd
-
Use Directory Service To Manage AD Objects - Windows Server
-
Looking For A Script To Add A Computer To A List Of Groups In AD
-
Adding Computer To AD Domain Group After AD Domain Join
-
How To Add A Computer To A Domain (GUI And PowerShell)
-
How To Add A Computer Account To A Group - System Center
-
Add User To Domain Group From Command Prompt
-
Add Computer To Group Using Add-ADGroupMember - ShellGeek
-
How To Check AD Group Membership With Command Line - Netwrix
-
How To Check AD Group Membership? - TheITBros
-
Adding Domain Users To The Local Administrators Group In Windows
-
How To Find Out Which Active Directory Groups You Are A Member Of
-
Configuring Permissions And Groups (Windows Server Domain ... - IBM
-
Net (command)/Localgroup - Wikiversity
-
Using The Net Command To Add Domain Users And Groups - YouTube