2

Can anyone help with a peice of batch script to restart an application service at scheduled time.

For example: If the service is "windows firewall " Then the script should restart this service every day at 09:00 AM and 09:00PM . Can someone help with complete code.(Assume that there is no dependency of this service on any other service).Any help is greately appreciated.

Thanks Harry

2 Answers 2

3

If you go to the services, and open Windows Firewall for example. You can see the service name, mpssvc. The way you would set the service to restart is by putting this in the batch file.

net stop mpssvc
net start mpssvc

You would want to save that to a shared location then add it to the scheduled tasks to run at the time you would like.

2
  • List all services by sc queryex type= service state= all | more Apr 10, 2019 at 19:44
  • 1
    @Nixphoe your code can be combined in one line using "&&".
    – Overmind
    Mar 2, 2020 at 12:59
0

OR SC start NameOfService

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .