How do I find what group I've put a server into

Is there a way to quickly find out a monitored server’s SCOM group membership in Squared Up? For example, I’ve got a server called CORP480; it would have been added to a group for whatever application it serves when it was approved in SCOM. I don’t want to have to go through every group I’ve created checking the membership!

You’d think we’d have some kind of server inventory wouldn’t you. Or a naming scheme that would give some clue…

2 Likes

There is a Powershell script you can use, it is very handy for this exact reason! Run it from the Ops Manager Pshell.

Import-module OperationsManager

$computerFQDN = Read-host “FQDN of Server”

#param($computerFQDN)

Get Windows Computer class

$computerClass = Get-SCOMClass -Name “Microsoft.Windows.Computer”

Get SCOM object # MonitoringObject (Microsoft.EnterpriseManagement.Monitoring.PartialMonitoringObject)

$computer = Get-SCOMClassInstance -Class $computerClass | Where-Object {($.FullName -eq $computerFQDN) -or ($.Name -eq $computerFQDN)}

Relationship classes

# Microsoft.SystemCenter.ComputerGroupContainsComputer – Group contains Computers – Groups that contain only computers

$relation1 = Get-SCOMRelationship -Name “Microsoft.SystemCenter.ComputerGroupContainsComputer”

Microsoft.SystemCenter.InstanceGroupContainsEntities – Contains Entities – Relationship between an instance group and the entities that it contains

$relation2 = Get-SCOMRelationship -Name “Microsoft.SystemCenter.InstanceGroupContainsEntities”

Get SCOM Groups

Get-SCOMRelationshipInstance -TargetInstance $computer | Where-Object {!$_.isDeleted -and

( ($.RelationshipId -eq $relation1.Id) -or ($.RelationshipId -eq $relation2.Id) )} `

| Sort-Object SourceObject | Out-GridView

Output is like the below

4 Likes

I have written this little script that will go through all your SCOM groups and report on its members - Hope this helps :slight_smile:


Import-Module OperationsManager

$SCOMGroups = (Get-SCOMGroup).Displayname
foreach ($SCOMGroup in $SCOMGroups) {
If (Get-scomgroup -Displayname $SCOMGroup| Get-SCOMClassInstance | sort Displayname | FT DisplayName) {
Write-Host “=================================================================”
Write-Host $SCOMGroup
Write-Host “=================================================================”
Get-scomgroup -Displayname $SCOMGroup | Get-SCOMClassInstance | sort DisplayName | FT DisplayName
}
}


2 Likes

In the case of a Distributed Application (but not a Group unfortunately) Squared Up provides a reverse look-up so can can see what DAs a server is a member of. This is in the server drilldown view, to the right of the screen. You can also easily get ‘down’ from a Group (or Groups) to see it’s contents. However, from the drilldown view, I’m not aware of any easy way to see what Groups a server is a member of. As such, other members of the community may have some better feedback for you on this.

Brilliant, just the job!

Thanks,

-Pete

Thanks very much, very useful.