Skip to content

Instantly share code, notes, and snippets.

@db
Created September 27, 2017 12:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save db/c77cfe34fe0f5b580ccf28610cd2e825 to your computer and use it in GitHub Desktop.
Save db/c77cfe34fe0f5b580ccf28610cd2e825 to your computer and use it in GitHub Desktop.
Start AppPool that has stopped
Import-Module WebAdministration
set-Location IIS:\AppPools
$AppPools = dir
foreach ($AppPool in $AppPools)
{
Write-Host "$AppPool.Name -> checking"
if($AppPool.state -ne "Started")
{
Write-Host "- $AppPool.Name found stopped - starting it"
Start-WebAppPool -Name $AppPool.Name
Write-Host "- $AppPool.Name started - OK"
}
else
{
Write-Host "- $AppPool.Name is running - OK"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment