Click here to Skip to main content
65,938 articles
CodeProject is changing. Read more.
Articles / web / IIS

Automate IIS Reboot Using Task Scheduler

0.00/5 (No votes)
22 Aug 2022CPOL1 min read 18K  
Create a new task and set up a IIS restart using Windows 10 Task Scheduler
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.

Image 1

Right click on Task Scheduler and click New Folder and give a name to the folder like IIS reset and click OK.

Image 2

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.

Image 3

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.

Image 4

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.

Image 5

In Conditions tab, I am keeping default power conditions as it is. You can change according to your need and click OK.

Image 6

In Settings tab, I am making some modifications and click OK.

Image 7

You can see your newly created task in task list. You can run right always to test, otherwise that will run on given schedule.

Image 8

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

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)