Page 1 of 1

Service control batch file

Posted: 14 Jan 2017 12:09
by kenhoover
I am running a virtual server environment and need a batch file to stop and start some services on different servers in a specified order. I have tried via the attached files, but there seems to be a lag time that interferes with the services starting in order. also, I believe that one of the service control commands needs to be started under different login credentials (for example the "poller" is logged in under a different account). Any help would be greatly appreciated, as I do not have much experience with CLI. Thank you.

Here is what I have:

rem This file will stop and restart the poller services in Oasis v 11.10

sc \\POLLER stop XXX.Xxxxxxxxxx.Poller.Client.Service
sc \\Prime2 stop XXX.Xxxxxxxxxx.Poller.MidTier.Service
sc \\Prime1 stop XXX.Xxxxxxxxxx.Meter.MidTier.Service

Choice /T 30

echo "Please wait for about 1 minute before continuing to allow the services to fully stop."

sc \\Prime1 start XXX.Xxxxxxxxxx.Meter.MidTier.Service
sc \\Prime2 start XXX.Xxxxxxxxxx.Poller.MidTier.Service
sc \\POLLER start XXX.Xxxxxxxxxx.Poller.Client.Service