Hi there,
i have list of windows servers(2000/2003/2008) in Column A, i need to get the status of App-pool and website running/stopped on them in same excel.
Technology Tips and News
Hi there,
i have list of windows servers(2000/2003/2008) in Column A, i need to get the status of App-pool and website running/stopped on them in same excel.
Please try this method:
$aPool = gwmi -Namespace "root\MicrosoftIISv2" -class "IIsApplicationPoolSetting" -filter "Name='W3SVC/APPPOOLS/DefaultAppPool'" $aPool.AppPoolState
AppPoolState will return 1=starting, 2=started, 3=stopping, 4=stopped
If you are using IIS 7.0+ you can also take use of the WebAdministration namespace aswell:
$aPool = gwmi -Namespace root\webAdministration -class ApplicationPool -filter "Name='DefaultAppPool'" | % { $_.GetState() } $aPool.ReturnValue
ReturnValue will return 1=started, 2=starting, 3 = stopped, 4=stopping
Please try this method:
$aPool = gwmi -Namespace "root\MicrosoftIISv2" -class "IIsApplicationPoolSetting" -filter "Name='W3SVC/APPPOOLS/DefaultAppPool'" $aPool.AppPoolState
AppPoolState will return 1=starting, 2=started, 3=stopping, 4=stopped
If you are using IIS 7.0+ you can also take use of the WebAdministration namespace aswell:
$aPool = gwmi -Namespace root\webAdministration -class ApplicationPool -filter "Name='DefaultAppPool'" | % { $_.GetState() } $aPool.ReturnValue
ReturnValue will return 1=started, 2=starting, 3 = stopped, 4=stopping