I'm currently using the following BAT file to restart a remote service:
sc \\MyServer stop MyRemoteService sc \\MyServer start MyRemoteService
This works great for one computer, but I want to use it to restart services in a farm. I could just list every server in my batch file, but I only want to restart services if they're already running. For example, if the service is running on one server in the farm, restart it, but if it's not already running, then leave it stopped.
Is there any way to accomplish this remotely? I'm not married to SC is there's another program that does this.