Quantcast
Channel: Operations Manager - General forum
Viewing all articles
Browse latest Browse all 11941

PowerShell: Error related with GetMonitoringPropertyValue

$
0
0

Greetings All, 

I have an array of computers with some with some elements. I want to get the PrincipalName of one so:

$principalNameProp = Get-MonitoringClassProperty -monitoringClass:$windowsComputerClass | where {$_.Name -eq 'PrincipalName'} 


$computerPrincipalName = $computer[1].GetMonitoringPropertyValue($principalNameProp);



But I'm receiving this error:

Cannot convert argument "property", with value: "PrincipalName", for "GetMonitoringPropertyValue" to type "Microsoft.EnterpriseManagement.Configuration.MonitoringClassProperty": "Cannot convert the 
"PrincipalName" value of type "System.String" to type "Microsoft.EnterpriseManagement.Configuration.MonitoringClassProperty"."
At line:1 char:1
+ $computers[1].GetMonitoringPropertyValue('PrincipalName')
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [], MethodException
    + FullyQualifiedErrorId : MethodArgumentConversionInvalidCastArgument


Any idea? This portion of code was working fine in SCOM2007.

Thanks,


Viewing all articles
Browse latest Browse all 11941

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>