The Best Rated EmaiI Signature Portal

IT Pro: How to exclude Office365 Groups using powershell (Bulk exclusion)

This guide will walk you through the steps on how to exclude Office365 Mail enabled Groups using Powershell. For reference - Exchange cmdlet syntax

Problem: Sender may receive a bounce-back message when sending to Office365 Groups.


Open Powershell using elevated Access

# Connect to your Exchange Online Tenant


# Assumes the Transport rule is named 'Xink-Auto-ReRouting-Catcher' and directs the rule name to the variable $XinkRule

$XinkRule = Get-TransportRule -Filter "Description -like 'Xink-Auto-ReRouting-Catcher'" -state enabled -ExcludeConditionActionDetails $false

# Captures the current list of the Office365 Groups.

$GroupList = Get-UnifiedGroup -ResultSize Unlimited | Select -ExpandProperty alias

#Applies the $GroupList from $XinkRule exceptions

$XinkRule | Set-TransportRule -ExceptIfAnyOfRecipientAddressContainsWords $GroupList

NOTE: If you received an error connecting to exchange online you need to run Install-Module -Name ExchangeOnlineManagement

Did you find it helpful? Yes No

Send feedback
Sorry we couldn't be helpful. Help us improve this article with your feedback.