Script to bulk restart a service on many workstations
Posted on 2011-05-06
I have a service on a few hundred Windows workstations I would like to restart using a script. The goal is:
1. Run this script against a text file with just a simply list of computer names.
2. Restart a specific service on each of these systems.
3. Pipe to a log file
I've seen a few things doing a quick google search, but most of what I see shows the sc.exe command...that's fine, but I'd hate to have to to a separate "stop" and a separate "start" for each service...I don't see a "restart" switch with sc.exe, and I'm not sure how to use it to run it against a text list of computers.
this is probably easy enough, but I'm a noob to this type of scripting. Prefer powershell, but could also do a vbscript...doesn't matter, just need help.