Skip to content

How to delete members from Distribution Group

Sometimes, you must delete members from a distribution list because they don’t belong there anymore. In the Microsoft admin center, you can only delete members from a single distribution group at a time. With PowerShell, there are more options to remove members from all distribution groups. In this article, you will learn how to delete distribution group members in Microsoft admin center and PowerShell.

Delete Distribution Group members in Microsoft 365

In the Microsoft 365 admin center, you can delete a distribution group member. We will show you how to remove multiple members from a distribution list.

To delete distribution group members in the Microsoft 365 admin center, follow these steps:

  1. Sign into Microsoft 365 admin center
  2. Expand Teams & groups > Active teams & groups
  3. Click Distribution list
  4. Click on the distribution group
  5. Click on Members
  6. Click View and manage members
Delete distribution group members from a single distribution list.
  1. Select multiple members
  2. Click on the three dots
  3. Click Remove members
Delete multiple distribution group members in Microsoft 365 admin center.
  1. Click Yes
Remove distribution group members in Microsoft 365 admin center.

You successfully deleted multiple members from a single distribution list. You can also delete members from a distribution list or mail-enabled security group in the Exchange admin center.

With PowerShell, there are more options to delete members, which we will show you in the next step. For example, you can delete a specific member from all distribution lists and mail-enabled groups.

Connect to Exchange Online PowerShell

To be able to run PowerShell commands, you must Connect to Exchange Online PowerShell. Open Windows PowerShell as administrator, run the below cmdlet, and sign in with your admin credentials.

Connect-ExchangeOnline

Remove-DistributionGroupMember Error: You don’t have sufficient permissions

Each distribution group has at least one manager (owner). It means only the distribution group manager is allowed to perform these management tasks. So when the Exchange Online administrator tries to update the properties of the distribution group with the Remove-DistributionGroupMember cmdlet, and it’s not the manager of this distribution group, the following error message appears.

Error: You don’t have sufficient permissions. This operation can only be performed by a manager of the group.

Notice that even a user with global administrator credentials can’t remove or make a change to a distribution group. The fact that you are not the distribution group manager could stop you from completing the required management task.

The PowerShell cmdlets you need to use for managing a distribution group include a parameter named -BypassSecurityGroupManagerCheck. So whenever you try to perform a management task, and the permission error appears, you can add the -BypassSecurityGroupManagerCheck parameter to the original PowerShell command.

See the below PowerShell command syntax example.

Remove-DistributionGroupMember -Identity "Distribution Group" -Member "Identity" -BypassSecurityGroupManagerCheck

In this case, you don’t have to be the manager (owner) of the distribution group to delete a member.

Remove member from Distribution Group

To delete a member from a distribution list or mail-enabled security group, we will use the Remove-DistributionGroupMember PowerShell cmdlet.

In our example, we will delete the member (David Kent) from the mail-enabled security group (Finance USA). We will also add the -Confirm:$false parameter to suppress the confirmation prompt.

See the below PowerShell command syntax to remove a distribution group member.

Remove-DistributionGroupMember -Identity "Distribution Group" -Member "Identity" -BypassSecurityGroupManagerCheck -Confirm:$false

Run the PowerShell command example.

Remove-DistributionGroupMember -Identity "FinanceUSA@m365info.com" -Member "David.Kent@m365info.com" -BypassSecurityGroupManagerCheck -Confirm:$false

Remove member from all Distribution List Groups

You can remove a specific member from all the distribution list groups with PowerShell.

In our example, the user Brenda.Smith@m365info.com is a member of multiple distribution groups. To remove the user (Brenda Smith) from each distribution list, we need to use the -Filter parameter.

  • Specify the UserPrincipalName (Brenda.Smith@m365info.com) on line 1
  • Run the below PowerShell script
$UPN = "Brenda.Smith@m365info.com"
$AllDistributionGroups = Get-DistributionGroup -ResultSize Unlimited -Filter { RecipientTypeDetails -eq "MailUniversalDistributionGroup" }

$User = @()
$User += Get-User -Identity $UPN -ErrorAction SilentlyContinue
$User += Get-Contact -Identity $UPN -ErrorAction SilentlyContinue

$userID = $User.Identity

foreach ($DistributionGroup in $AllDistributionGroups) {

    $groupMembers = Get-DistributionGroupMember -Identity $DistributionGroup.DistinguishedName | Select-Object -ExpandProperty Name
    if ($groupMembers -contains $userID ) {
        Write-Host "Removing member from group '$($DistributionGroup.Name)'" -ForegroundColor Green
        Remove-DistributionGroupMember -Identity $DistributionGroup.DistinguishedName -Member $userID -BypassSecurityGroupManagerCheck -Confirm:$false
    }
}

Remove member from all Distribution List and Mail-Enabled Security Groups

You can also remove a specific user from all distribution lists and mail-enabled security groups.

In our example, the user Brenda.Smith@m365info.com is a member of multiple distribution lists and mail-enabled groups. We want to remove the user (Brenda Smith) from all these groups.

  • Specify the UserPrincipalName (Brenda.Smith@m365info.com) on line 1
  • Run the below PowerShell script
$UPN = "Brenda.Smith@m365info.com"
$AllDistributionGroups = Get-DistributionGroup -ResultSize Unlimited

$User = @()
$User += Get-User -Identity $UPN -ErrorAction SilentlyContinue
$User += Get-Contact -Identity $UPN -ErrorAction SilentlyContinue

$userID = $User.Identity

foreach ($DistributionGroup in $AllDistributionGroups) {

    $groupMembers = Get-DistributionGroupMember -Identity $DistributionGroup.DistinguishedName | Select-Object -ExpandProperty Name
    if ($groupMembers -contains $userID ) {
        Write-Host "Removing member from group '$($DistributionGroup.Name)'" -ForegroundColor Green
        Remove-DistributionGroupMember -Identity $DistributionGroup.DistinguishedName -Member $userID -BypassSecurityGroupManagerCheck -Confirm:$false
    }
}

Bulk remove all members from specific Distribution Group

With PowerShell, you can remove all the members from a specific distribution list or mail-enabled security group.

In our example, we want to bulk remove all existing members from the distribution group Sales USA with a PowerShell script.

  • Specify the distribution group primary SMTP address on line 1
  • Run the below PowerShell script
$groupName = "SalesUSA@m365info.com"
$DistributionGroupMember = Get-DistributionGroupMember $groupName
ForEach ($member in $DistributionGroupMember) {
    try {
        Remove-DistributionGroupMember -Identity $groupName –Member $member.Name -BypassSecurityGroupManagerCheck -Confirm:$false
        Write-Host "Successfully removed $($member.DisplayName) from '$groupName'" -ForegroundColor Green
    }
    catch {
        Write-Host "An error occurred while removing $($member.DisplayName) from '$groupName' $_" -ForegroundColor Red
    }
}

That’s it!

Read more: How to remove Full Access mailbox permission »

Conclusion

You learned how to delete distribution group members. In the Microsoft 365 admin center, you can remove a single or multiple members from a distribution list group. With PowerShell, it’s easier and faster to remove a specific member from all distribution groups using a script.

Did you enjoy this article? You may also like Remove Azure AD users with Microsoft Graph PowerShell. Don’t forget to follow us and share this article.

o365info Team

o365info Team

This article was written by our team of experienced IT architects, consultants, and engineers.

This Post Has 0 Comments

Leave a Reply

Your email address will not be published. Required fields are marked *