We can create a user group on the local computer from Windows command line using ‘net localgroup‘ command.
net localgroup group-name /add
Example:
To add a new group ‘Group1‘
C:\>net localgroup Group1 /add The command completed successfully. C:\>
To delete a user group:
net localgroup group-name /delete
For example to delete the user group Group1 created in the above example, we can run the below command.
net localgroup Group1 /delete
Net localgroup command can be used on the local computers whereas net group command can be used on domain controller machines.
Rename a local user group:
net localgroup command does not have any option to rename a group. We can use wmic command to rename a group. Below is the command for this.
wmic group where "name='groupname' " call rename newgroupname
Ex: Rename the group ‘group1’ as ‘group2’
wmic group where "name='group1' " call rename group2
Related Posts:
Add user to group from windows command line
Delete user from group using command prompt
Hey Guys ,
This really worked but did not work when there is a space inside group , For example If i create a group as testgroup it works , And if i try to create test group it doesnt works , It takes test as a group and group as something else .
Can you provide a script or command which works with space inside group
siva, try wrapping the group name in quotes: net localgroup “group-name” /add
I just verified that Billy’s suggestion works.
Example:
What about localgroup setup? For example I need to put for user’s belong in a localgroup – read only permissions. But all user can change selfs objects, files and directories.