Start/Stop App Pool IIS6.0 with Powershell or command line Start/Stop App Pool IIS6.0 with Powershell or command line powershell powershell

Start/Stop App Pool IIS6.0 with Powershell or command line


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 DefaultAppPoolIIS6AppPool Stop AppPool #1IIS6AppPool Recycle Some other app pool

Source and binaries are available on bitbucket. May this save somebody else a few minutes of head scratching.


You might be interested in this Powershell library I started maintaining:

psDeploy : http://rprieto.github.com/psDeploy/

Among other things it has lots of cmdlets for IIS6 automation, for example Start-IIS6AppPool, New-IIS6Website...

I hope it helps!