Hi all,
Having difficulty collecting daily counts of discovered SCOM Classes etc split by Operating Server amount etc, not sure if anyone has managed to do this.
My SCOM result is coming back a return value of 0 instead of the actual figure, outside of SCOM this works.
The performance rule is as followed:
import-module OperationsManager
$ScomAPI = New-Object -comObject “MOM.ScriptAPI”
$Instances = @(“Microsoft.Windows.Server.Computer”, “Microsoft.Windows.Server.2008.Computer”)
Foreach ($Instance in $Instances)
{
$query = (Get-SCOMClass –name $instance | Get-SCOMClassInstance | Select Path)
$PropertyBag = $ScomAPI.CreatePropertyBag()
$PropertyBag.AddValue(“Metric”,$query.count)
$PropertyBag.AddValue(“Instance”,$Instance)
Send output to SCOM
$PropertyBag
}
This is targeted to All Management Servers Resource Pool, and the performance counters are:
Instance = $Data/Property[@Name=‘Instance’]$
Value = $Data/Property[@Name=‘Metric’]$
Thanks in advance.