Block specific email address or domain in O365

Connect to O365 either via Azure Powershell or Windows Powershell

Run the following commands in one go, just feed the Global Administrator details when prompted.

Import-Module MSOnline
$O365Cred = Get-Credential
$O365Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri -Credential $O365Cred -Authentication Basic -AllowRedirection
Import-PSSession $O365Session -AllowClobber
Connect-MsolService -Credential $O365Cred

Once connected, run the following command to block the Email Address or Email Domain

Get-Mailbox -ResultSize Unlimited | Set-MailboxJunkEmailConfiguration -BlockedSendersAndDomains "","","",""

Check the addition in bulk : 

Get-Mailbox -ResultSize Unlimited | Set-MailboxJunkEmailConfiguration

Result will look like :

Download Remote Control Tool For Free


Popular posts from this blog

How To Work On Cross Site Failure in Exchange 2010 Environment (Failover and Failback)

Activate Exchange 2010 Manually

Migrating SBS 2003 to Windows Server 2008 with Exchange 2007