Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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?

share|improve this question

migrated from stackoverflow.com Feb 25 '10 at 20:16

This question came from our site for professional and enthusiast programmers.

3 Answers 3

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>
share|improve this answer

May I suggest writing a single local script that:

  1. Uses net start/start \server to start/stop service remotely.
  2. Deletes a file on \\server\d$\...

You can iterate over a list of server names and run those 2 commands.

share|improve this answer

You could use psexec from sysinternals http://technet.microsoft.com/en-us/sysinternals/bb897553.aspx

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.