我有PowerShell代码从SCOM中提取groupinfo
$d = Get-SCOMAlert -Criteria "Id = 'ab0b795c-3564-406c-b6d5-257b8788eefb"
$d|fl
[Microsoft.Windows.Server.LogicalDisk] .FileSystem:NTFS
[Microsoft.Windows.Server.LogicalDisk]。压缩:错误
[Microsoft.Windows.Server.LogicalDisk] .Size:146780712960
[Microsoft.Windows.Server.LogicalDisk] .SizeNumeric:139981
[IsManaged:是的
HealthState:成功
StateLastModified:2013年6月28日下午12:53:41
IsAvailable:真实
AvailabilityLastModified:2013年7月2日下午2:40:35
DisplayName:C:
....
我可以看到[Microsoft.Windows.Server.LogicalDisk] .FileSystem noteproperty 如果我在我的选择陈述中使用外卡
$d | select healthstate, *filesystem, id |fl
HealthState:成功
[Microsoft.Windows.Server.LogicalDisk] .FileSystem:NTFS
Id:4dfb9975-5815-a950-16ff-086f5e58e8d5
但我无法弄清楚如何直接选择
$d.[Microsoft.Windows.Server.LogicalDisk].FileSystem
请告知
这是d $ |的输出得到构件
TypeName: Microsoft.EnterpriseManagement.Monitoring.MonitoringObject
Name MemberType Definition
---- ---------- ----------
OnRelatedEntitiesChanged Event System.EventHandler`1[Microsoft.Ent...
ApplyTemplate Method System.Void ApplyTemplate(Microsoft...
BeginExecuteMonitoringTask Method System.IAsyncResult BeginExecuteMon...
Commit Method System.Void Commit(Microsoft.Enterp...
ContainsProperty Method bool ContainsProperty(Microsoft.Ent...
CreateNavigator Method System.Xml.XPath.XPathNavigator Cre...
EndExecuteMonitoringTask Method System.Collections.ObjectModel.Read...
Equals Method bool Equals(System.Object obj)
ExecuteMonitoringTask Method System.Collections.ObjectModel.Read...
GetClasses Method System.Collections.Generic.IList[Mi...
GetCopy Method Microsoft.EnterpriseManagement.Comm...
GetDiscoverySources Method System.Collections.ObjectModel.Read...
GetHashCode Method int GetHashCode()
GetLeastDerivedNonAbstractClass Method Microsoft.EnterpriseManagement.Conf...
GetLeastDerivedNonAbstractMonitoringClass Method Microsoft.EnterpriseManagement.Conf...
GetMaintenanceWindow Method Microsoft.EnterpriseManagement.Moni...
GetMaintenanceWindowHistory Method System.Collections.ObjectModel.Read...
GetMonitorHierarchy Method Microsoft.EnterpriseManagement.Comm...
GetMonitoringAlertReader Method Microsoft.EnterpriseManagement.Moni...
GetMonitoringAlerts Method System.Collections.ObjectModel.Read...
GetMonitoringAlertsCount Method int GetMonitoringAlertsCount(), int...
GetMonitoringClasses Method System.Collections.ObjectModel.Read...
GetMonitoringConsoleTasks Method System.Collections.ObjectModel.Read...
GetMonitoringDiagnostics Method System.Collections.ObjectModel.Read...
GetMonitoringDiscoveries Method System.Collections.ObjectModel.Read...
GetMonitoringEventReader Method Microsoft.EnterpriseManagement.Moni...
GetMonitoringEvents Method System.Collections.ObjectModel.Read...
GetMonitoringLinkedReports Method System.Collections.ObjectModel.Read...
GetMonitoringPerformanceData Method System.Collections.ObjectModel.Read...
GetMonitoringPerformanceDataReader Method Microsoft.EnterpriseManagement.Moni...
GetMonitoringProperties Method System.Collections.ObjectModel.Read...
GetMonitoringPropertyValue Method System.Object GetMonitoringProperty...
GetMonitoringRecoveries Method System.Collections.ObjectModel.Read...
GetMonitoringRelationshipObjects Method System.Collections.ObjectModel.Read...
GetMonitoringRelationshipObjectsWhereSource Method System.Collections.ObjectModel.Read...
GetMonitoringRelationshipObjectsWhereTarget Method System.Collections.ObjectModel.Read...
GetMonitoringReports Method System.Collections.ObjectModel.Read...
GetMonitoringRules Method System.Collections.ObjectModel.Read...
GetMonitoringStateHierarchy Method Microsoft.EnterpriseManagement.Comm...
GetMonitoringStates Method System.Collections.Generic.IList[Mi...
GetMonitoringTaskResults Method System.Collections.ObjectModel.Read...
GetMonitoringTasks Method System.Collections.ObjectModel.Read...
GetMonitoringViews Method System.Collections.ObjectModel.Read...
GetMostDerivedClasses Method System.Collections.Generic.IList[Mi...
GetMostDerivedMonitoringClasses Method System.Collections.ObjectModel.Read...
GetParentMonitoringObjects Method System.Collections.ObjectModel.Read...
GetParentPartialMonitoringObjects Method System.Collections.ObjectModel.Read...
GetProperties Method System.Collections.Generic.IList[Mi...
GetRelatedMonitoringObjects Method System.Collections.ObjectModel.Read...
GetRelatedPartialMonitoringObjects Method System.Collections.ObjectModel.Read...
GetResultantCategoryOverrides Method Microsoft.EnterpriseManagement.Conf...
GetResultantOverrides Method Microsoft.EnterpriseManagement.Conf...
GetStateHierarchy Method Microsoft.EnterpriseManagement.Comm...
GetType Method type GetType()
InsertCustomMonitoringEvent Method System.Void InsertCustomMonitoringE...
InsertCustomMonitoringEvents Method System.Void InsertCustomMonitoringE...
InsertCustomMonitoringPerformanceData Method System.Void InsertCustomMonitoringP...
IsInstanceOf Method bool IsInstanceOf(Microsoft.Enterpr...
Overwrite Method System.Void Overwrite(Microsoft.Ent...
PopulateAccessRights Method System.Void PopulateAccessRights(Mi...
RecalculateMonitoringState Method Microsoft.EnterpriseManagement.Runt...
Reconnect Method System.Void Reconnect(Microsoft.Ent...
ResetMonitoringState Method Microsoft.EnterpriseManagement.Runt...
ScheduleMaintenanceMode Method System.Void ScheduleMaintenanceMode...
StopMaintenanceMode Method System.Void StopMaintenanceMode(Sys...
SubmitMonitoringTask Method System.Guid SubmitMonitoringTask(Mi...
ToString Method string ToString()
TryGetProperty Method bool TryGetProperty(Microsoft.Enter...
UpdateMaintenanceMode Method System.Void UpdateMaintenanceMode(S...
[Microsoft.Windows.Computer].PrincipalName NoteProperty Microsoft.EnterpriseManagement.Comm...
[Microsoft.Windows.LogicalDevice].Description NoteProperty Microsoft.EnterpriseManagement.Comm...
[Microsoft.Windows.LogicalDevice].DeviceID NoteProperty Microsoft.EnterpriseManagement.Comm...
[Microsoft.Windows.LogicalDevice].Name NoteProperty Microsoft.EnterpriseManagement.Comm...
[Microsoft.Windows.LogicalDisk].VolumeName NoteProperty Microsoft.EnterpriseManagement.Comm...
[Microsoft.Windows.Server.LogicalDisk].Compressed NoteProperty Microsoft.EnterpriseManagement.Comm...
[Microsoft.Windows.Server.LogicalDisk].DriveType NoteProperty Microsoft.EnterpriseManagement.Comm...
[Microsoft.Windows.Server.LogicalDisk].FileSystem NoteProperty Microsoft.EnterpriseManagement.Comm...
[Microsoft.Windows.Server.LogicalDisk].QuotasDisabled NoteProperty Microsoft.EnterpriseManagement.Comm...
[Microsoft.Windows.Server.LogicalDisk].Size NoteProperty Microsoft.EnterpriseManagement.Comm...
[Microsoft.Windows.Server.LogicalDisk].SizeNumeric NoteProperty Microsoft.EnterpriseManagement.Comm...
[Microsoft.Windows.Server.LogicalDisk].SupportsDiskQuota NoteProperty Microsoft.EnterpriseManagement.Comm...
[Microsoft.Windows.Server.LogicalDisk].SupportsFileBasedCompression NoteProperty Microsoft.EnterpriseManagement.Comm...
[System.ConfigItem].AssetStatus NoteProperty Microsoft.EnterpriseManagement.Comm...
[System.ConfigItem].Notes NoteProperty Microsoft.EnterpriseManagement.Comm...
[System.ConfigItem].ObjectStatus NoteProperty Microsoft.EnterpriseManagement.Comm...
[System.Entity].DisplayName NoteProperty Microsoft.EnterpriseManagement.Comm...
Item ParameterizedProperty Microsoft.EnterpriseManagement.Comm...
AvailabilityLastModified Property System.Nullable`1[[System.DateTime,...
DisplayName Property System.String DisplayName {get;}
FullName Property System.String FullName {get;}
HasChanges Property System.Boolean HasChanges {get;}
HealthState Property Microsoft.EnterpriseManagement.Conf...
Id Property System.Guid Id {get;set;}
InMaintenanceMode Property System.Boolean InMaintenanceMode {g...
IsAvailable Property System.Boolean IsAvailable {get;}
IsManaged Property System.Boolean IsManaged {get;}
IsNew Property System.Boolean IsNew {get;}
LastModified Property System.DateTime LastModified {get;}
LastModifiedBy Property System.Nullable`1[[System.Guid, msc...
LeastDerivedNonAbstractManagementPackClassId Property System.Guid LeastDerivedNonAbstract...
LeastDerivedNonAbstractMonitoringClassId Property System.Guid LeastDerivedNonAbstract...
MaintenanceModeLastModified Property System.Nullable`1[[System.DateTime,...
ManagementGroup Property Microsoft.EnterpriseManagement.Mana...
ManagementGroupId Property System.Guid ManagementGroupId {get;}
ManagementPackClassIds Property System.Collections.Generic.IList`1[...
MonitoringClassIds Property System.Collections.ObjectModel.Read...
Name Property System.String Name {get;}
Path Property System.String Path {get;}
StateLastModified Property System.Nullable`1[[System.DateTime,...
TimeAdded Property System.DateTime TimeAdded {get;}
Values Property System.Collections.Generic.IList`1[...
答案 0 :(得分:4)
有两种方法。您可以将属性名称包装在字符串中:
$d.'[Microsoft.Windows.Server.LogicalDisk].FileSystem'
或者,您可以将属性名称保存到变量:
$propertyName = '[Microsoft.Windows.Server.LogicalDisk].FileSystem'
$d.$propertyName