Restart IIS appPool

During the development of new web apps, we often perform testing with different system setup (where the values are stored in the database). And we have many web app that runs on it's own appPool. Restarting the appPool manually takes quite a while.

To avoid the cumbersome steps to restart all the necessary appPool, we came out with a script (shown below). It's convenient and never miss out any of the appPool that cripple the test case.

Import-Module WebAdministration

cd IIS:\AppPools

$l = Get-ChildItem | where name -Like '*myApps*' | select name

foreach ($a in $l) {
    Write-Host "Restart appPool $($a.name).."
    Restart-WebAppPool $($a.name)
}

Write-Host "Done"

Comments

Popular posts from this blog

Scheduled task in Windows Task Scheduler - part 3

Create scheduled task in Windows Task Scheduler

Get all website entries in IIS