Scheduling an IIS Application Pool Recycle
Just putting this information out there for anyone that might need it…
I recently got to a point at work where I needed to frequently perform a “recycle” event for an IIS application pool that we have running. (Had to do with a known bug in the software we were using - iMIS - and frequent recycling was the only temporary fix.) Anyway, instead of manually doing that every 2 hours or so, it turns out that there’s an option to set that schedule.
If you right-click on the application pool in question and select properties, you can specify the following section: “Recycle worker processes at the following times:” and then just enter whatever times of the day (in military time) that you’ll be needing to recycle.
It seemed like this was working but I wanted to verify that the recycle was actually taking place. Turns out Microsoft had some information on adding IIS recycle events to the system logs / Event Viewer.
Just open up the CMD prompt, change the directory (in my case it was C:\Inetpub\AdminScripts) and run the following CMD:
cscript adsutil.vbs Set w3svc/AppPools/DefaultAppPool/AppPoolRecycleSchedule true
Voila. The W3SVC event showed up on time in the System Event Viewer. Now I know the recycle event (Event ID 1076) is happening at the specified time.