The Author Online Book Forums are Moving

The Author Online Book Forums will soon redirect to Manning's liveBook and liveVideo. All book forum content will migrate to liveBook's discussion forum and all video forum content will migrate to liveVideo. Log in to liveBook or liveVideo with your Manning credentials to join the discussion!

Thank you for your engagement in the AoF over the years! We look forward to offering you a more enhanced forum experience.

mod2008 (6) [Avatar] Offline
#1
Hello All,

Just wondering if anyone knows how to return the status of IIS 6.0 App Pools (running or not) in Powershell?

Thanks,

Ivan.
Shay (10) [Avatar] Offline
#2
Re: IIS 6 App Pools
Try:

$server="server"
$wmi = [WmiSearcher] "Select * From IIsApplicationPool"
$wmi .Scope.Path = "\$server ootmicrosoftiisv2"
$wmi .Scope.Options.Authentication = [System.Management.AuthenticationLevel]:smilieacketPrivacy
$wmi .Get() | select name,AppPoolState


Possible values for AppPoolState:
1 = starting
2 = running
3 = stopping
4 = stopped
any other value =unknown

-----
Shay Levi
$cript Fanatic
http://scriptolog.blogspot.com
Shay (10) [Avatar] Offline
#3
Re: IIS 6 App Pools
Sorry, I used the wrong WMI class smilie

$server="server"
$wmi = [WmiSearcher] "Select * From IIsApplicationPoolsetting"
$wmi.Scope.Path = "\$server ootmicrosoftiisv2"
$wmi.Scope.Options.Authentication = [System.Management.AuthenticationLevel]:smilieacketPrivacy
$wmi.Get() | select name,AppPoolState


-----
Shay Levi
$cript Fanatic
http://scriptolog.blogspot.com
mod2008 (6) [Avatar] Offline
#4
Re: IIS 6 App Pools
Shay,

That's great - exactly what I was looking for.

Thanks,

Ivan.