Thursday, January 27, 2011

Batch Script to restart service

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

  • 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.

    From Nixphoe
  • OR SC start NameOfService

    From Vito

0 comments:

Post a Comment