So I have this array called $monitors. I don't think it really matters what it contains, but it's a list of SCOM monitors, created with the following two lines:
Start-OperationsManagerClientShell -ManagementServerName: "your-mgmt-server" -PersistConnection: $false -Interactive: $false;
$monitors = Get-SCOMMonitor | Where-Object -Property XmlTag -eq "UnitMonitor"
Outputing this array, it's members seem to have two properties called Overridden and Target (scroll all the way to the right):
PS D:\Daniel> $monitors
Enabled DisplayName ParentMonitorID Overri Target
dden
------- ----------- --------------- ------ ------
true Database Performance (rollup) ManagementPackElementUniqueIdentif... True SQL Server 2005 DB Engine
true File Share Shadow Copy Availability ManagementPackElementUniqueIdentif... False File Server VSS Agent Service (Windows Serv...
true Server Role hosts User Service Category - Configuration ManagementPackElementUniqueIdentif... False Server Role
false Delt-Astraia License Monitor ManagementPackElementUniqueIdentif... False Windows Server
true DB Memory-Optimized Data Filegroup Space (rollup) ManagementPackElementUniqueIdentif... True SQL Server 2016 DB
But according to Get-Member
, "Overridden" does not exist:
PS D:\Daniel> $monitors | gm
TypeName: Microsoft.EnterpriseManagement.Configuration.ManagementPackUnitMonitor
Name MemberType Definition
---- ---------- ----------
CheckVersionCompatibility Method System.Collections.Generic.IList[Microsoft.EnterpriseManagement.Configuration.Verification.ManagementPackVerificationResult] CheckVersionCompatibilit...
CreateNavigator Method System.Xml.XPath.XPathNavigator CreateNavigator(), System.Xml.XPath.XPathNavigator IXPathNavigable.CreateNavigator()
Equals Method bool Equals(System.Object obj)
GetCategories Method System.Collections.Generic.IList[Microsoft.EnterpriseManagement.Configuration.ManagementPackCategory] GetCategories()
GetDisplayString Method Microsoft.EnterpriseManagement.Configuration.ManagementPackDisplayString GetDisplayString(cultureinfo culture), Microsoft.EnterpriseManagement.Config...
GetFolders Method Microsoft.EnterpriseManagement.Configuration.ManagementPackElementCollection[Microsoft.EnterpriseManagement.Configuration.ManagementPackFolder] GetFo...
GetHashCode Method int GetHashCode()
GetImageReferences Method System.Collections.Generic.IEnumerable[Microsoft.EnterpriseManagement.Configuration.ManagementPackImageReference] GetImageReferences()
GetKnowledgeArticle Method Microsoft.EnterpriseManagement.Configuration.ManagementPackKnowledgeArticle GetKnowledgeArticle(cultureinfo culture), Microsoft.EnterpriseManagement....
GetManagementPack Method Microsoft.EnterpriseManagement.Configuration.ManagementPack GetManagementPack()
GetOverrideableParameters Method System.Collections.Generic.IList[Microsoft.EnterpriseManagement.Configuration.ManagementPackOverrideableParameter] GetOverrideableParameters()
GetType Method type GetType()
Reconnect Method void Reconnect(Microsoft.EnterpriseManagement.Configuration.ManagementPack mp), void Reconnect(Microsoft.EnterpriseManagement.EnterpriseManagementGro...
ToString Method string ToString()
Verify Method System.Collections.Generic.IList[Microsoft.EnterpriseManagement.Configuration.Verification.ManagementPackVerificationResult] Verify(Microsoft.Enterpr...
WriteXml Method void WriteXml(System.Xml.XmlWriter writer)
Accessibility Property Microsoft.EnterpriseManagement.Configuration.ManagementPackAccessibility Accessibility {get;set;}
AlertSettings Property Microsoft.EnterpriseManagement.Configuration.ManagementPackMonitorAlertSettings AlertSettings {get;set;}
Category Property Microsoft.EnterpriseManagement.Configuration.ManagementPackCategoryType Category {get;set;}
Comment Property string Comment {get;set;}
Configuration Property string Configuration {get;set;}
ConfirmDelivery Property bool ConfirmDelivery {get;set;}
Description Property string Description {get;set;}
DisplayName Property string DisplayName {get;set;}
Enabled Property Microsoft.EnterpriseManagement.Configuration.ManagementPackMonitoringLevel Enabled {get;set;}
HasNonCategoryOverride Property bool HasNonCategoryOverride {get;}
Id Property guid Id {get;}
Identifier Property Microsoft.EnterpriseManagement.Configuration.ExtensionIdentifier Identifier {get;}
InstanceName Property string InstanceName {get;set;}
LanguageCode Property string LanguageCode {get;set;}
LastModified Property datetime LastModified {get;set;}
ManagementGroup Property Microsoft.EnterpriseManagement.EnterpriseManagementGroup ManagementGroup {get;}
ManagementGroupId Property guid ManagementGroupId {get;}
Name Property string Name {get;}
OperationalStateCollection Property Microsoft.EnterpriseManagement.Configuration.ManagementPackSubElementCollection[Microsoft.EnterpriseManagement.Configuration.ManagementPackUnitMonito...
ParentMonitorID Property Microsoft.EnterpriseManagement.Configuration.ManagementPackElementReference[Microsoft.EnterpriseManagement.Configuration.ManagementPackAggregateMonit...
Priority Property Microsoft.EnterpriseManagement.Configuration.ManagementPackWorkflowPriority Priority {get;set;}
Remotable Property bool Remotable {get;set;}
RunAs Property Microsoft.EnterpriseManagement.Configuration.ManagementPackElementReference[Microsoft.EnterpriseManagement.Configuration.ManagementPackSecureReferenc...
Status Property Microsoft.EnterpriseManagement.Configuration.ManagementPackElementStatus Status {get;set;}
Target Property Microsoft.EnterpriseManagement.Configuration.ManagementPackElementReference[Microsoft.EnterpriseManagement.Configuration.ManagementPackClass] Target ...
TimeAdded Property datetime TimeAdded {get;set;}
TypeID Property Microsoft.EnterpriseManagement.Configuration.ManagementPackElementReference[Microsoft.EnterpriseManagement.Configuration.ManagementPackUnitMonitorTyp...
XmlTag Property string XmlTag {get;}
The Target property does exist, but it holds quite different values if I try to print it using Format-Table
:
PS D:\Daniel> $monitors | Format-Table Target
Target
------
ManagementPackElementUniqueIdentifier=e817d034-02e8-294c-3509-01ca25481689
ManagementPackElementUniqueIdentifier=0302db52-58b0-43ff-65fe-0b492a1461ae
ManagementPackElementUniqueIdentifier=979b9385-5195-5be8-ce28-1467a6323c36
ManagementPackElementUniqueIdentifier=2d34f1de-ce5d-9a5d-bce1-67b75619d3a6
Expanding the property still doesn't reveal the values we saw earlier:
PS D:\Daniel> $monitors | Select-Object -ExpandProperty Target | Format-List *
Name :
Id : e817d034-02e8-294c-3509-01ca25481689
Identifier : 1|Microsoft.Windows.Library/31bf3856ad364e35|1.0.0.0|Microsoft.Windows.Server.Computer||
Name :
Id : 0302db52-58b0-43ff-65fe-0b492a1461ae
Identifier : 1|Microsoft.Windows.2016.Cluster.Management.Library/31bf3856ad364e35|1.0.0.0|Microsoft.Windows.10.0.Cluster.NetworkInterface||
Name :
Id : 979b9385-5195-5be8-ce28-1467a6323c36
Identifier : 1|Microsoft.Windows.InternetInformationServices.2000/31bf3856ad364e35|1.0.0.0|Microsoft.Windows.InternetInformationServices.2000.FTPSite||
How to I access the Target and Overridden parameters, so I can sort on them, export them to CSV, etc.?