
Here’s the command for running a command on a list of remote systems: psexec.exe -s cmd /c "net localgroup administrators /add domainuseraccount" You might find it easiest just to put this list in the same directory as PSEXEC- that’s what I’m doing in this example. A text file with a system name on each line will do: To do this, we first need to create the list of systems. This could be hundreds or thousands of systems (note that PSEXEC will not multithread though- each command is run sequentially). Now for the cool part- we can feed PSEXEC a list of systems to run this command on. Using PSEXEC, we can run this command for a remote system using the following command: psexec.exe - s \targetsystem cmd /c "net localgroup administrators /add domainuseraccount"

Net localgroup administrators /add domainuseraccountĮasy enough. To start, you need to come up with the command you want to run on each system. To add a computer account to Local Admins of a local system, the command is: You’ll have to agree to the EULA on the first run of any of the files. Once you have downloaded the PSTOOLS, extract all of the executables somewhere easy to access from the command prompt. For a breakdown of the switches you can use with PSEXEC, check here. PSEXEC was the most direct solution, and it is actually really simple. Sure, there’s several ways to do this, but I didn’t want to rely on an old SCCM 2007 infrastructure to get this done, or set up a Group Policy and OU. I had a client recently where we needed to add an account to the local administrators on a large number of systems.

Another extremely useful feature of PSEXEC is the ability to run the same command for a list of systems. Of course, you must be an administrator on the remote system, but you can also throw a switch at PSEXEC to run as a different user (a service account, for instance). In short, PSEXEC allows you to execute a command on a remote system. For those of you who haven’t, check out the entire PSTOOLS suite– it is an extremely powerful set of tools. I’m sure most of you out there have heard of and used PSEXEC (it’s been around for a while).
