I'm using IIS 6.0 and looking for a way to stop/start the app pool. I know there is a stop-appPool for powershell in 7.0 but using 6.0. :-( So does anyone have a powershell script or another command line exe that will stop/start the app pool?
Thanks.
Configuring Auto-Start with IIS ManagerIn the Connections pane, select the Application Pools node, revealing the Application Pools pane in the main view. Select the application pool for which you wish to enable Auto-Start. Locate the Start Mode option under the General group and set it to AlwaysRunning. Click OK.
How to Stop Application Pools Using the IIS Manager. On the Connections pane, expand the server node and click Application Pools to display all Application Pools. On the Application Pools page, select the application pool for the published application that is running. Click Stop to stop the application pool.
Ok here it is, I just add a switch to stop the app pool else it starts since no harm in starting an app pool that is already started:
param([string]$appPoolName, [switch]$stop)
$appPool = get-wmiobject -namespace "root\MicrosoftIISv2" -class "IIsApplicationPool" | where-object {$_.Name -eq "W3SVC/AppPools/$appPoolName"}
if($appPool)
{
if($stop)
{
$appPool.Stop()
}
else
{
$appPool.Start()
}
}
If anybody is looking for a purely command-line tool that does not require Powershell, I have created such a thing based on the information contained in these other answers. Since the original question is specifically looking for possible command-line alternatives, I thought I would share it here.
Usage is quite simple:
IIS6AppPool Start DefaultAppPool
IIS6AppPool Stop AppPool #1
IIS6AppPool Recycle Some other app pool
Source and binaries are available on bitbucket. May this save somebody else a few minutes of head scratching.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With