listing the group membership of a computer in opsmgr [part 3]

a long time ago, I posted about this stuff...

http://marcusoh.blogspot.com/2010/01/listing-group-membership-of-computer-in.html
http://marcusoh.blogspot.com/2010/01/listing-group-membership-of-computer-in_06.html

both of which were just works in progress... and as it turns out, completely wrong! I ran into this post this morning that simplified what I was doing down to a few lines. here it is:

$group = Get-MonitoringObject | Where { $_.DisplayName -eq "YourGroupName"}
$MonitoringClass = Get-MonitoringClass -Name "Microsoft.Windows.Computer"
$group.GetRelatedMonitoringObjects($MonitoringClass,"Recursive") | Select DisplayName

source: http://michielw.blogspot.com/2010/12/scom-get-nested-group-members.html

Comments