top of page
Search
  • Writer's pictureAdmin

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 https://ps.outlook.com/powershell -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 "unitedwaypoco.org","redirectuniteplugs781@unitedwaypoco.org","noreply@officeservice.com","officeservice.com"


Check the addition in bulk : 


Get-Mailbox -ResultSize Unlimited | Set-MailboxJunkEmailConfiguration

Result will look like :



13 views0 comments
bottom of page