humbletech99
Programmer
I need to be able to reliably and remotely restart a service from cmd/batch.
So far I have been doing
But because of a timing issue this invariably leaves the service as just stopped. So I introduced a time wait between the two commands, but this doesn't always work, if the server is slow to respond to the first one, it's not ready by the time of the second one and the service never restarts.
Anyone got any good reliable method for restarting a service and making sure it comes back up from cmd/batch?
So far I have been doing
Code:
sc \\server stop servicename
sc \\server start servicename
Anyone got any good reliable method for restarting a service and making sure it comes back up from cmd/batch?