User Tools

Site Tools


microsoft:cli:add_user_to_group

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
microsoft:cli:add_user_to_group [2016/03/09 13:23] – created rpleckomicrosoft:cli:add_user_to_group [2016/03/09 14:05] (current) rplecko
Line 1: Line 1:
-In Windows computer we can add users to a group from command line. We can use net localgroup command for this. +=== Add User to Group - CLI === 
-net localgroup group_name UserLoginName /add+ 
 +[[http://www.windows-commandline.com/add-user-to-group-from-command-line/|http://www.windows-commandline.com/add-user-to-group-from-command-line/]] 
 + 
 +In Windows computer we can add users to a group from command line. We can use net localgroup command for this. net localgroup group_name UserLoginName /add
  
 For example to add a user to administrators group, we can run the below command. In the below example I have taken username as John. For example to add a user to administrators group, we can run the below command. In the below example I have taken username as John.
  
-  net localgroup administrators John /add+<code> 
 +net localgroup administrators John /add 
 +</code>
  
-**//Few more examples://**+**//Few more examples:// **
  
 To add a domain user to local users group: To add a domain user to local users group:
  
-  net localgroup users domainname\username /add+<code> 
 +net localgroup users domainname\username /add 
 +</code>
  
 This command should be run when the computer is connected to the network. Otherwise you will get the below error. This command should be run when the computer is connected to the network. Otherwise you will get the below error.
 +
 <code> <code>
 H:\>net localgroup users domain\user /add H:\>net localgroup users domain\user /add
Line 20: Line 28:
  
 To add a domain user to local administrator group: To add a domain user to local administrator group:
-  net localgroup administrators domainname\username /add+ 
 +<code> 
 +net localgroup administrators domainname\username /add 
 +</code>
  
 To add a user to remote desktop users group: To add a user to remote desktop users group:
-  net localgroup "Remote Desktop Users" UserLoginName  /add 
  
-To add a user to debugger  users group:  +<code> 
-  net localgroup "Debugger users" UserLoginName /add+net localgroup "Remote Desktop Users" UserLoginName  /add 
 +</code>
  
-To add a user to Power users group:  +To add a user to debugger users group: 
-  net localgroup "Power users" UserLoginName /add+ 
 +<code> 
 +net localgroup "Debugger users" UserLoginName /add 
 +</code> 
 + 
 +To add a user to Power users group: 
 + 
 +<code> 
 +net localgroup "Power users" UserLoginName /add 
 +</code>
  
 This 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. This 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.
Line 42: Line 62:
  
 When you run the ‘net localgroup’ command from elevated command prompt: When you run the ‘net localgroup’ command from elevated command prompt:
 +
 <code> <code>
 C:\>net localgroup administrators techblogger /add C:\>net localgroup administrators techblogger /add
Line 48: Line 69:
  
 To list the users belonging to a particular group we can run the below command. To list the users belonging to a particular group we can run the below command.
-  net localgroup group_name+ 
 +<code> 
 +net localgroup group_name 
 +</code>
  
 For example to list all the users belonging to administrators group we need to run the below command. For example to list all the users belonging to administrators group we need to run the below command.
-  net localgroup administrators+ 
 +<code> 
 +net localgroup administrators 
 +</code> 
 + 
 +To remove user from group: 
 + 
 +  net localgroup administrators domain\group /delete\\ 
microsoft/cli/add_user_to_group.1457529805.txt.gz · Last modified: 2016/03/09 13:23 (external edit)