Net localgroup command can be used to manage local user groups on a computer. Using this command, administrators can add users to groups, delete users from groups, create new groups and delete existing groups. Below you can find syntax for all these operations.
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
List the user groups on the local computer
‘net localgroup‘ command displays the list of user groups on the local computer.
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.
Add a user to 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
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.
Delete user from 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.
{ 1 comment… read it below or add one }
Thanks