If you are a domain administrator and looking to add users to domain or active directory group from command prompt, this post shows you how to do that with net group
command.
Execute the below steps to add users to domain group.
- Open command prompt
- Run the below command
net group groupName userName /ADD /DOMAIN
Example:
To add a user named ‘dave’ to the domain group “Domain Admins”
C:\>net group "Domain Admins" testuser /ADD /DOMAIN The command completed successfully.
Now list the members of the domain group.
C:\>net group "Domain Admins" Group name Domain Admins Comment Designated administrators of the domain Members ------------------------------------------------------------------------------- Administrator dave The command completed successfully.
In this example case, the group name has white space in it, that’s why it’s wrapped up double quotes, so that the command reads the whole thing as as group name.
Thanx a lot!