Thursday, 23 June 2016

Windows service restart script suitable for Windows Task scheduler.

Or, How to create a Service Restart .bat script?
Or, .bat script for windows service restart.

Descriptions: To create .bat script suitable for windows task scheduler, first you need to have the service name and then write a small script for that service to be stopped and started.

My Scenario: I want to create a .bat script for restartig windows update services which should compatible to be executed manually by command prompt, by double click or by pointing in Task Scheduler Windows Task management console.

Below are the steps:
1. Go to Run > Services.msc > Search for the service Windows Update > Go to Properties of this service > Copy the name of the service as highlighted in red in below screenshot:


















2. Now open a Notepad > Type the commands as shown in below screenshot.
{Net Stop “wuauserv”}
{Net Start “wuauserv”}












3. Go to File > Click on Save As > Give any name you want with .bat extension > in my case its “WindowsUpdateServiceRestart.bat”.


















5. The .bat file script will look like below.



















Now you can use this script as per the scenario explain above in this article. Let me know if you still need any help on this.. Cheers!

No comments:

Post a comment