Net localgroup command is used to manage local user groups on a computer. Using this command, administrators can add local/domain users to groups, delete users from groups, create new groups and delete existing groups. Below you can find syntax for all these operations.
How to create a new local group
We can use below command to create a new local group.
net localgroup /add groupname
Example:
Command for adding a new user group ‘testgroup’
net localgroup /add testgroup
Add a user to local group
Below is the syntax for adding a user to a local group.
net localgroup groupname username /add
For example, to add user ‘user1’ to the group ‘testgrp’ the command is:
net localgroup testgrp user1 /add
How to add domain group to local group
Net localgroup command is used to add a domain group to a local group. The syntax is same as adding a user.
net localgroup localGroupName domainGroupName /ADD
List the users that belong to a group
net localgroup groupname
prints the list of users in a group.
Example:
c:\>net localgroup testgrp Alias name testgrp Comment Members ------------------------------------------------------------------------------- test The command completed successfully.
How to list all local user groups on the computer
Run ‘net localgroup‘ command to list all local user groups.
Example:
c:\>net localgroup Aliases for \\WINCMD-PC ------------------------------------------------------------------------------- *Administrators *Backup Operators *Power Users *Remote Desktop Users *Replicator *testgrp *Users
Some of the groups listed above, are created by default with Windows installation.
How to delete a user from local group
Below is the command for deleting a user from a group.
net localgroup groupname username /delete
To delete user ‘user1’ from the group ‘testgrp’ the command is:
net localgroup testgrp user1 /delete
All the above commands should be run from elevated administrator command prompt in Vista and Windows 7. Other wise an error will be generated as shown below.
C:>net localgroup /add test1 System error 5 has occurred. Access is denied.
Thanks
how do I remove all users in a group but leave the group intact on the local computer?
net localgroup username /delete (but what is the syntax for removing all members of the local group?)
please and thank you!
-E
is there a way to create an admin on a school computer, ive tried recovery and system disk image, but i need an admin to sign in for it
I am not able to add any program because of administrator will not let it run. I am the administrator I thought but there is local group administrator. How do I get rid of the group.