Running Scripts in multiple systems – Windows

System Administrators would want to run some simple scripts in multiple computers. Microsoft has some great tools to ease the job, PsTools bundle is really powerful easy tool.

PsExec can be used to run scripts on remote computers.

Below is a simple example to find uptime of multiple systems and dumping to a file.

Enter the system names in a notepad and save as a batch file (eg. mc.bat)

Have a script written and save it as a batch file “uptime.bat”. (systeminfo | find “Up Time” >> \\<Server share>\uptime.txt)

Now use psexec to run it. Ensure you are in the directory where the tool is. Also ensure admin share is enabled in the remote systems. Below command will run the uptime script in the systems mentioned in mc.bat file

psexec @mc.bat -u “username” -p “password” /c “path to script”

To execute in a single remote system, below is the command

psexec \\<ip> -u “username” -p “password” /c “path to script”

Just makes our task easier. We can do lots with this. Have it downloaded and explored in the below link,