How to check User and Shared Mailbox Forwards in O365
This script will allow you to check all user mailbox forwards and shared mailboxes forwards enabled in your tenant.
You will need to know how to save a mailbox script. A quick guide is to do the following:
1. Copy the script below
Get-Mailbox | select UserPrincipalName,ForwardingSmtpAddress,DeliverToMailboxAndForward | Export-CSV UserMailboxForwards.csv -NoTypeInformation
2. Paste it into the notepad file and when saving, copy the below.
2a. You can then run them via Powershell. I normally CD to the folder in question and then to run a script, you will need to type the following .\ in front of the name to order Powershell to run the script.
It will then save the results in a .csv.
The two scripts you will want to run are:
Get-Mailbox | select UserPrincipalName,ForwardingSmtpAddress,DeliverToMailboxAndForward | Export-CSV UserMailboxForwards.csv -NoTypeInformation
Get-mailbox | where {$_.forwardingaddress -ne $null}| select UserPrincipalName,ForwardingAddress,ForwardingSmtpAddress,DeliverToMailboxAndForward | Export-CSV SharedMailboxForwarding.csv -NoTypeInformation