By default a new app pool will want to recycle itself on a regular time interval every 1740 minutes.

I want to clear this setting so the IIS never recycles it.


This will clear the time interval setting on the app pool

Import-Module WebAdministration
$pool = "IIS:\AppPools\mywebapp"
Set-ItemProperty $pool -Name Recycling.periodicRestart.time -Value 0.00:00:00

The below PowerShell script will help of check the status of the application pool recycle and restart/start/stop. So you can make integrate the below script in Task scheduler for specific interval time for checking the status of the App pool and start if it stopped. You may also include the email trigger if its stopped and started by the script.

if (Test-Path IIS:\AppPools\$AppPoolName){
# Start App Pool if stopped else restart
#Get the runtime state of the DefaultAppPool and checking the status
if ((Get-WebAppPoolState($AppPoolName)).Value -eq "Started"){
Write-Output "Starting IIS app pool"
#starting the App Pool
Stop -WebAppPool $AppPoolName

Refer for full example : https://dotnet-helpers.com/powershell-demo/application-pool-monitoring-automation-powershell-to-check-if-an-application-pool-has-stopped

Your Answer

By clicking "Post Your Answer", you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.