views:

803

answers:

2

Hi,

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.

A: 

Hi,

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()
   }
}
Bruce227
A: 

Hi,

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!

Gromix