Operations Manager Command Shell Main Menu
Welcome to TechNet Blogs Sign in | Join | Help
All groups and their contained instances

SELECT     SourceMonitoringObjectDisplayName AS 'Group', TargetMonitoringObjectDisplayName AS 'Member'
FROM         RelationshipGenericView
WHERE     (SourceMonitoringObjectDisplayName IN
                          (SELECT     ManagedEntityGenericView.DisplayName
                            FROM          ManagedEntityGenericView INNER JOIN
                                                       (SELECT     BaseManagedEntityId
                                                         FROM          BaseManagedEntity WITH (NOLOCK)
                                                         WHERE      (BaseManagedEntityId = TopLevelHostEntityId) AND (BaseManagedEntityId NOT IN
                                                                                    (SELECT     R.TargetEntityId
                                                                                      FROM          Relationship AS R WITH (NOLOCK) INNER JOIN
                                                                                                             dbo.fn_ContainmentRelationshipTypes() AS CRT ON R.RelationshipTypeId = CRT.RelationshipTypeId
                                                                                      WHERE      (R.IsDeleted = 0)))) AS GetTopLevelEntities ON
                                                   GetTopLevelEntities.BaseManagedEntityId = ManagedEntityGenericView.Id INNER JOIN
                                                       (SELECT DISTINCT BaseManagedEntityId
                                                         FROM          TypedManagedEntity WITH (NOLOCK)
                                                         WHERE      (ManagedTypeId IN
                                                                                    (SELECT     DerivedManagedTypeId
                                                                                      FROM          dbo.fn_DerivedManagedTypes(dbo.fn_ManagedTypeId_Group()) AS fn_DerivedManagedTypes_1))) AS GetOnlyGroups ON
                                                   GetOnlyGroups.BaseManagedEntityId = ManagedEntityGenericView.Id))
ORDER BY 'Group'

Posted: Saturday, April 25, 2009 4:03 AM by jtalmquist
Leave a Comment

(required) 

(required) 

(optional)

(required) 

  
Enter Code Here: Required

Comment Notification

If you would like to receive an email when updates are made to this post, please register here

Subscribe to this post's comments using RSS

Page view tracker