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)
{
&n
}