Run a batch file on remote servers

batch-file

I have a batch file which stops a service and deletes a file from d:\ drive.
I want to execute this on 20 servers.
Is there a quicker way than manually logging on each server, copying and running batch file?

Best Answer

You could try using PsExec. If the batch file is present in all machines at same location, then you could mention the list of machines in a text file and give it as an argument to this.Something like,

psexec @<machines_list_file> <location to batch file on remote machines>

If you dont have it on remote machine, you need to copy the batch file and then execute it using,

psexec @<machines_list_file> -c <location to batch file in current machine>