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,