Add Groups and Users to a computer

Posted by Techie Cocktail | 10:58 PM | | 0 comments »

Many of us use 'Computer Management' snap-in to add Groups and users in groups. There is a command line utility available to perform the same task. It really saves time and effort. The utility is called 'net.exe' found in C:\<Windows>\System32 folder.

Commands you can use are as below:

a. Add a group
NET LOCALGROUP <group_name> /add

b. Delete a group
NET LOCALGROUP <group_name> /del

c. Add a user to a group
NET LOCALGROUP <group_name> <user_name | domain\username> /add

d. Delete a user from a group
NET LOCALGROUP <group_name> <user_name | domain\username> /del

This is not just what net.exe can do. Type net.exe /? for help, output as below. The result shows all the available options. To further check the use of these options, type
net.exe <option> /?, NET LOCALGROUP /? syntax as shown in the 2nd screen.

Screen 1



Screen 2



As in this article, we have used LOCALGROUP to add groups and users to the computer. Check out other options as well to see what other wonders it can do to increase your productivity.

Note, To create Groups & Users on a remote computer use PSEXEC.EXE.

0 comments