Moderation on groups, especially global company comms groups is a good thing because it means that not just anyone can email them. Many companies only allow HR, IT, Security or other groups to send email to everyone in the company.

I put together a script that will not only set the moderators but also enable moderation on a Distribution Group. The script has some manual input required which is as follows:

  • GroupName (Line 5) – This is the name of the Distribution Group you want to enable moderation on.
  • ModeratedBy (Line 18) – This specifies the person or group that will be the moderator.

Below is the output after enabling Moderation and setting the Moderator for the group call Finance:

Enabled moderation on a group

If you run the script again, it will advise you that Moderation is set and displays the current Moderator:

Check Moderation on a group

We can run the same script from PowerShell ISE as this adds/imports the Exchange Snapin and displays the same results as above:

PowerShell script to specify the moderators


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

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

# Specify the name of the distribution group
$groupName = "GroupNameHere"

# Get information about the distribution group
$group = Get-DistributionGroup -Identity $groupName

# Check if moderation is already enabled
if ($group.ModerationEnabled) {
    Write-Host "Moderation is already enabled for the distribution group: $groupName"
    Write-Host "Current moderators: $($group.ModeratedBy -join ', ')"
} else {
    # Check if there are no moderators
    if (-not $group.ModeratedBy) {
        # Add a moderator (replace "administrator" with the actual moderator's account)
        Set-DistributionGroup -Identity $groupName -ModeratedBy User
        Write-Host "Added a new moderator to the distribution group: $groupName"

    # Enable moderation for the distribution group
    Set-DistributionGroup -Identity $groupName -ModerationEnabled $true

    # Display confirmation message
    Write-Host "Moderation has been enabled for the distribution group: $groupName"

PowerShell makes your life easier but always remember, only certain things can be set in the GUI, the rest is all PowerShell. The GUI (Exchange Admin Center) performs PowerShell commands in the background.

Hope it helps.


    Discover more from Everything-PowerShell

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

    Continue reading