Thursday, January 16, 2014

Exchange Online Distribution Group Delivery Management


I recently carried out a large migration and my customer had 700 Distribution Groups. My customer asked me to restrict delivery of emails to the groups by members only. So end users could not email the distribution group unless they were a member. 

So how do I do this for 700 users!! Powershell to the rescue.

Connect to Exchange Online via Powershell and run this command.


  1. Get-Distributiongroup | export-csv C:\users\disti.csv
  2. I then deleted all columns in the csv except for PrimarySmtpAddress and then renamed that column to distiname.
  3. Then run this command
    Import-Csv "C:\Users\sofarrell\Desktop\disti.csv" | Foreach-Object{get-distributiongroup $_.distiName | Set-distributiongroup -AcceptMessagesOnlyFromDLMembers $_.distiname}
  4. And then run this command
    Import-Csv "C:\Users\sofarrell\Desktop\disti.csv" | Foreach-Object{get-distributiongroup $_.distiName | Set-distributiongroup -AcceptMessagesOnlyFromSendersOrMembers $_.distiname}
Job done , Happy Customer.



No comments:

Post a Comment