In this tip, you will learn how to automate IIS restart and schedule the restart based on given date and time using Windows task scheduler.
Introduction
The Task Scheduler is a Windows component that can automatically run tasks at a specific time or in response to a specific event. For example, tasks can be run when the computer starts or when a user logs in. You can start tasks when a specific event occurs and using task scheduler, you can run commands and execute scripts at a specific day and time.
Getting Started
Search task scheduler in Windows search.
Right click on Task Scheduler and click New Folder and give a name to the folder like IIS reset and click OK.
Making a folder makes your tasks separate, so you can manage them easily.
Now right click on new created folder and select Create Task and provide task name. In General tab, enter Name and Description and choose Run whether user is logged on or not.
Go to Triggers tab and click on New button to create a new trigger and enter schedule details according to your need and click OK.
Now go to Actions tab and create new button to create a new action, provide given Program/script path and arguments and we are rebooting IIS in this post, provide iisreset path in Program/script path and click OK.
In Conditions tab, I am keeping default power conditions as it is. You can change according to your need and click OK.
In Settings tab, I am making some modifications and click OK.
You can see your newly created task in task list. You can run right always to test, otherwise that will run on given schedule.
Points of Interest
In this tip, we learned how to create a new task and set up a IIS restart using Windows 10 Task Scheduler.
History
- 22nd August, 2022: Initial version