I am trying to write a batch script for the following deployment scenario:
I have a list of services (about 10 of them) that run on a remote server (target for deployment). Before deploying any files to the server, I want to stop any of those 10 services if they are running. Then I can copy/override whatever files I need to for the deployment. Once the deployment is complete, I need to restart ONLY those services that were running prior to the deployment.
I know to use the 'sc' command to stop and start the services, I just don't know how to keep track of which services need to be restarted.
Any help would be greatly appreciated. A sample that depicts a possible solution would be even better.