Skip to content

Instantly share code, notes, and snippets.

@chiguniiita
Created January 19, 2022 05:33
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 chiguniiita/0302f88e8ac1a4336c32e465243e0790 to your computer and use it in GitHub Desktop.
Save chiguniiita/0302f88e8ac1a4336c32e465243e0790 to your computer and use it in GitHub Desktop.
PowerShell script to stop all ApplicationPools in IIS.
Import-Module WebAdministration
foreach ($POOL in Get-IISAppPool){
$POOL_NAME = $POOL.Name
if((Get-WebAppPoolState -Name $POOL_NAME).Value -ne 'Stopped'){
Write-Output ('Stopping Application Pool: {0}' -f $POOL_NAME)
Stop-WebAppPool -Name $POOL_NAME
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment