Microsoft 365

Microsoft 365: List all Mailbox Forwarding Rules (Server)

As you may have noticed, I currently do focus more on cloud technologies, in particular Microsoft 365. The way I see it is that on-premise computing will slowly be fading away and cloud computing will be the leading-edge technology. Suprise, suprise, this blog post is again about Microsoft 365. I will show you how to list all mailboxserver forwarding rules.

First of all, I want to point out that there are user created rules and that there are server rules created by mailbox or Microsoft 365 administrators. In this blog post I will carry out listing forwarding rules created in Exchange Online, respectively those rules created by administrators.

Connect to Microsoft 365 / Exchange Online

First we need to connect to our tenant. Run the commands below to open a PowerShell session to your Microsoft cloud.


Install-Module -Name ExchangeOnlineManagement -Force -AllowClobber

Connect-ExchangeOnline -UserPrincipalName user@domain.com -ShowProgress $true

Fine. Let’s move on.

Listing Mailbox Forwarding Rules

Copy and paste the code below into your Microsoft 365 PowerShell session to list all mailbox server forwarding rules.


Get-Mailbox -ResultSize Unlimited `
-Filter "ForwardingAddress -like '*' -or ForwardingSmtpAddress -like '*'" |
Select-Object Name,ForwardingAddress,ForwardingSmtpAddress

Anmerkung 2020-04-11 090010.png

For nicer output, you can pipe the command to any export- or out- cmdlet of your choosing, for example to ConvertTo-Html and Out-File.


Get-Mailbox -ResultSize Unlimited `
-Filter "ForwardingAddress -like '*' -or ForwardingSmtpAddress -like '*'" |
Select-Object Name,ForwardingAddress,ForwardingSmtpAddress |
ConvertTo-Html |
Out-File $home\mailboxserverforwardingrules.htm

Start-Process $home\mailboxserverforwardingrules.htm

This will show up the html file in a browser window.

Anmerkung 2020-04-11 091005.png

Mission accomplished. Hope this was helpful.

See also

Microsoft 365: Show Mailboxes that have Auto-Reply enabled

Microsoft 365: Add User Accounts and Mailboxes with PowerShell

10 replies »

  1. I have been sifting through the internet to find this exact thing. Thank you so much, this was extremely helpful.

    Like

  2. The article is very good, but how do you find out which boxes are being redirected to a specific user?

    Example, I want to know all the boxes that are being redirected to my user, is it possible?

    Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.