When working with shared mailboxes, there is a problem: the user connected to this mailbox cannot configure the Junk Mail Settings for this shared mailbox in Outlook itself. In this blog post I show how to configure the junk mail settings for a shared mailbox using the Exchangen Online module and PowerShell.
Prerequisites
If you have not already done so, install the Exchange Online module. Open PowerShell and enter the following line.
Install-Module -Name ExchangeOnlineManagement -Force -AllowClobber
Next, we connect to Exchange Online.
Connect-ExchangeOnline
Action
In my case I use the Shared Mailbox gf@sid-500.com. Let’s do some checks to see what the junk mail configuration looks like.
Get-Mailbox -Identity gf@sid-500.com | Get-MailboxJunkEmailConfiguration
As we can see there are no blocked or trusted senders here.
Now I will show an example how to add trusted senders.
Set-MailboxJunkEMailConfiguration –Identity "gf@sid-500.com" `
–TrustedSendersAndDomains "sid-500.at","microsoft.com"
To undo what was configured before you can run the following command.
Set-MailboxJunkEmailConfiguration -Identity "gf@sid-500.com" `
-TrustedSendersAndDomains @{Remove="bildung.at","sek1@bildung.at"}
Last but least: If you want to configure this settings on all shared mailboxes, just run this command.
Get-Mailbox -RecipientTypeDetails SharedMailbox | Set-MailboxJunkEMailConfiguration ...
Hope this was helpful.
Categories: Microsoft 365, PowerShell
1 reply »