Service control batch file

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
kenhoover
Posts: 1
Joined: 14 Jan 2017 11:55

Service control batch file

#1 Post by kenhoover » 14 Jan 2017 12:09

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

Post Reply