Home > Operations Manager 2007 Powershell > OpsMgr 2007 Powershell – list group members

OpsMgr 2007 Powershell – list group members

Sometimes I like posting things that I utilize at work just so I can find them easier, or refer forums posters to it. This is one of those posts. I needed to dump the group membership into a file. Line 1 loads the group information into an array. Line 2 gets the specified group information. Line 3 uses a function to return all group members and loads that information into an array. Line 4 formats the array and dumps only the display name into a file.

$Groups = Get-MonitoringObjectGroup
$Group = $Groups | where {$_.DisplayName -eq "Group Name"}
$Members = $Group.GetRelatedMonitoringObjects()
$Members | Sort DisplayName | FT DisplayName | out-file C:\GroupName.txt


Props to Andreas Zuckerhut, as I copied some of his code…

  1. February 1, 2012 at 11:34 am

    Refer to http://techibee.com/powershell/powershell-get-scom-groups-of-a-computer-account/1129 if you want to do it other way. i.e get scom groups of a computer object.

  2. rupesh
    April 25, 2012 at 11:03 pm

    nice script..thanks fpr posting

  3. Andy Perry
    December 3, 2012 at 8:36 am

    Nice!! I have been trying to get this for ages. I guess i have been searching in the wrong place 🙂 Saves me having to pull this out from SQL, and can now add it to a master PS script that pulls out other agent data

  4. December 4, 2012 at 3:03 am

    here is one more Script that you can use

    foreach ($group in get-monitoringobjectGroup) {if($group.DisplayName -eq “Production”) {$group.GetRelatedMonitoringObjects() | select DisplayName,HealthState | export-csv -notype C:\GroupName.csv}}

  5. Ted
    March 26, 2014 at 10:33 am

    Working in SCOM 2012 just change the cmdlet from $Groups = Get-MonitoringObjectGroup
    to $Groups = Get-SCOMGroup

  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: