Freigeben über


Powershell: Retrieve Group Membership for a given Computer in Operations Manager (2012/ 2012 R2)

 

In System Center Operations Manager (2012/ 2012 R2) you may find it difficult to retrieve all the Groups a given Computer Instance belongs to.

Doing it via Powershell it becomes quite simple – something you can achieve by running the following script:

 

Import-Module OperationsManager 

$ComputerFQDN = '<YourServerFQDNname>'

$Groups = Get-SCOMGroup

Write-Host $ComputerFQDN " is member of the following Groups:"

Write-Host "============================================================================="

 

Foreach ($Group in $Groups){

$Members = $Group.GetRelatedMonitoringObjects()

Foreach ($Member in $Members){

If ($Member.DisplayName -eq $ComputerFQDN) {

Write-Host $Group.DisplayName

}

}

}

 

Hope you found it helpful! J

Comments

  • Anonymous
    May 08, 2017
    Great script...How can i output the result to a file?
  • Anonymous
    May 29, 2017
    Great script.Thank you!