How to add users to the Remote Computers local Administrators groups
-
First you need to download – PSEXEC – a command line tool that will allow you to execute commands on remote workstations.
-
Once downloaded open My Computer/Computer and navigate to: C:\Windows\System32 on your local machine.
-
Extract the zip file contents to the System32 folder (this will allow you to run the psexec command from any folder within Command Prompt).
-
Navigate to your Documents or Desktop and create a new txt file called: computernames.txt
-
In the computernames.txt document – add (one in each new line) the computer names that you will like to add the user to the Administrators group of.
-
Once they have been added – save the time with the computer names.
-
Now we need to create a batch script – open a new Notepad document and in the first line type:
PSEXEC.EXE @computernames.txt NET LOCALGROUP Administrators DOMAIN**USERID** /ADD
-
Replace – DOMAIN & USERID with the user you would like to add.
-
Press File and click Save As and type in: “addusers_multiple.bat”
-
This will save the file as a batch script
-
Now – run the script to start importing the users into the remote computers local administrators group.
Note: Proper syntac allows for the group name to be set like ” NET LOCALGROUP “Administrators” – however my test on a Windows XP workstation didn’t like the “” so I got rid of them – if you encounter an error with unable to find local group – re add them around the group name in the script.
Note: Tested on Windows 7 workstations without an issue.