How to remotely stop/start an application pool in IIS 8 How to remotely stop/start an application pool in IIS 8 powershell powershell

How to remotely stop/start an application pool in IIS 8


You can do the following to start your application pool :

Invoke-Command -ComputerName "REMOTE_SERVER" -ScriptBlock { Start-WebAppPool -Name "MY_FANCY_APPPOOL" }

You can do the following to stop your application pool :

Invoke-Command -ComputerName "REMOTE_SERVER" -ScriptBlock { Stop-WebAppPool -Name "MY_FANCY_APPPOOL" }


To start, sometimes you need to add an explicit wait so that the app pool responds to control messages:

Invoke-Command -ComputerName "$REMOTE_SERVER" -ScriptBlock { Import-Module WebAdministration; Start-Sleep -s 10; Start-WebAppPool -Name "$APP_POOL_NAME" }

And to stop:

Invoke-Command -ComputerName "$REMOTE_SERVER" -ScriptBlock { Import-Module WebAdministration; Stop-WebAppPool -Name "$APP_POOL_NAME" }