Steps to run a CMD command against multiple servers using PsExec.exe
Download PSTools from http://technet.microsoft.com/en-us/sysinternals/bb896649.aspx
Copy PsExec.exe from the package to a directory.
>Create a Text file Server.txt in the same folder.
>Add the list of servers to the Text file. ( Make sure all the servers are from the same domain and this procedure is being performed from a server in the same domain).
>Open an elevated command prompt.
>Change the directory to where the PsExec.exe and the text file is located.
>Run the command in below format
PsExec.exe @Server.txt <CMD you want to
execute>
Example:
- To check IP configuration for all the servers in the list and also capture the output in a text file Result.txt
PsExec.exe @Server.txt
ipconfig > Result.txt
- To change time zone in all the servers to UTC
PsExec.exe @Server.txt
tzutil /s “UTC”