Group to Which a Computer Belongs

Group to Which a Computer Belongs

How do we view the groups to which a computer belongs to in SCOM 2012 using powershell 

import-module operationsmanager
New-SCManagementGroupConnection -ComputerName ManagementServer1
$computername = "Server1.contoso.com"
$computer = Get-SCOMClass -name ”Microsoft.Windows.Computer” | Get-SCOMClassInstance | where { $_.Name -like $computername}
$groups = $computer.getMonitoringrelationshipObjectswhereTarget()
foreach ($group in $groups)
{
    if($computername -ne $group.SourceMonitoringObject)
    {


        write-host $group.SourceMonitoringObject
    }
}
Leave a Comment
  • Please add 1 and 3 and type the answer here:
  • Post
Wiki - Revision Comment List(Revision Comment)
Comments
  • Richard Mueller edited Original. Comment: Comma separate the tags

  • Richard Mueller edited Revision 1. Comment: Modified title casing

Page 1 of 1 (2 items)
Wikis - Comment List
Posting comments is temporarily disabled until 10:00am PST on Saturday, December 14th. Thank you for your patience.
Comments
  • Richard Mueller edited Original. Comment: Comma separate the tags

  • Richard Mueller edited Revision 1. Comment: Modified title casing

Page 1 of 1 (2 items)