Add user to local Computer group via Comand Line

You can add users to a local security group via the command line with the following  command:

netlocalgroup "groupname" "username" /add

and to confirm it worked:

netlocalgroup "groupname"

I wrote a simple little script to run this via powershell with user input.


























If you have the psexec tools installed you can run it for a remote machine using the following command

psexec \\RemotePC -u UserName -p password net localgroup "Localgroup" "Username" /add

You can download PsExec tools from here.