In my previous blog post, we posted a script that would enable moderation on a Distribution Group and set a Moderator.

In this blog post, we will use PowerShell to find all Distribution Groups that have moderation enabled as well as show the moderators of those groups.

Below is an example of that the output will look like once the script has been run:

Moderation of groups in PowerShell

The same results are shown if the script is run from PowerShell ISE:

Find groups that are moderated in PowerShell ISE

The script has the option in to Add/Import the Exchange Snapin as seen above in line 2 of the code.

Script

Here is the script that was used to get the information, you can modify it to suite your requirements:

# Import the Exchange module
Add-PSSnapin Microsoft.Exchange.Management.PowerShell.SnapIn

# Get all distribution groups with moderation enabled
$groups = Get-DistributionGroup -ResultSize Unlimited | Where-Object { $_.ModerationEnabled -eq $true }

# Display the results
foreach ($group in $groups) {
    Write-Host "Distribution Group Name: $($group.DisplayName)"
    Write-Host "Moderation Enabled: $($group.ModerationEnabled)"
    Write-Host "Moderated By: $($group.ModeratedBy)"
    Write-Host "----------------------"
}

In this script, no manual changes are required as it is purely checking Exchange Server 2019 for all groups that have moderation enabled along with all the moderators.

Hope it helps.

Discover more from Everything-PowerShell

Subscribe now to keep reading and get access to the full archive.

Continue reading