Notification Groups - How to list members with powershell
It was asked of me today: How can I get the groups and group members that are in a Notification Group?
After a bit of pondering, this is what I came up with.
$Notifications = get-notificationsubscription | ? {$_.DisplayName -match "Sharepoint Notifications"}
$Groups = Get-MonitoringObjectGroup
foreach ($NotificationGroupID in ($Notifications.Configuration).MonitoringObjectGroupIds)
{
$WorkingGroup = $Groups | ? {$_.Id -match $NotificationGroupID}
$WorkingGroup | Select DisplayName
$Members = $WorkingGroup.GetRelatedMonitoringObjects()
$Members | Sort DisplayName | Select DisplayName
""
}
Example Output:
DisplayName
-----------
All Sharepoint Computers
Server1.Example.com
Server2.Example.com
Server3.Example.com
All Sharepoint Databases
DBServer1.Example.com
DBServer2.Example.com
Comments
- Anonymous
January 01, 2003
The comment has been removed - Anonymous
January 01, 2003
Yes you do.