This discussion has been locked. The information referenced herein may be inaccurate due to age, software updates, or external references.
You can no longer post new replies to this discussion. If you have a similar question you can start a new discussion in this forum.

IIS App Pool Status with Powershell

I realize AppInsight can do this out of the box, but for various reasons AppInsight isn't an option. I'm trying to get the status of an application pool and display it using a Powershell monitor, but having an issue with getting it to work right;

import-module WebAdministration

$results = Get-ChildItem IIS:\AppPools\* | Where-Object { $_.Name -like "www.mysite.com*" }

foreach ($item in $results) {

$appPool = $item.Name

$status = $item.State

write-host "Message:$appPool"

write-host "Statistic.:$status"

}

The above only lists the first result, and shows Statistic as "NaN".  If I remove the Statistic line, it outputs all of the results, but reports "get output failed".

What am I missing here?

Parents Reply Children