PowerShell to disable Application Pool timeouts

There are few things more annoying in life than debugging in Visual Studio and getting an App Pool timeout in IIS7+ and having to start again…

See below my PowerShell script to disable this on all application pools.

Disclaimer: Only to be run on a development environment. Really!!!

$AppPools = Get-WmiObject -Class IISApplicationPoolSetting -Namespace 'root/microsoftiisv2' | Where-Object {$_.Name -like 'W3SVC/APPPOOLS*'}

if ($AppPools)
    foreach ($AppPool in $AppPools)
         Write-Host("    WAM Pool: " + $AppPool.Name + ", " + $AppPool.WAMUserName + " (" + $AppPool.WAMUserPass + ")")
         $AppPool.IdleTimeout = 0
         $AppPool.PingingEnabled = 0

Of course you could do this manually via the GUI but if you’re lazy like me you might just use CKS:Dev to attach to all IIS worker processes… but then which one timed out?? Infuriating! You would have to go through them all…

Anyway hope this helps!

Leave a Reply

Your email address will not be published. Required fields are marked *