Recently, I worked on getting a report of all users who have Email forwarding enabled. Users can have forwarding enabled at their mailbox level and / or mailbox rules.
Forwarding Enabled on Mailbox Level:
Get-Mailbox -Organizationalunit “OU Path” | where {$_.ForwardingAddress -ne $null} | ft -wrap -autosize Name, ForwardingAddress, DeliverToMailboxAndForward
Forwarding Set up using Mailbox Rules
$Mailboxes = (Get-Mailbox -Database name).Distinguishedname
foreach ($m in $Mailboxes)
{Get-inboxrule -Mailbox $m | ? {$_.ForwardTo -ne $null -or $_.ForwardAsAttachmentTo -ne $null -or $_.RedirectTo -ne $null} | ft -wrap -autosize identity, name, forwardto, redirect}
If you have multiple databases of the same client for e.g. Test_DB_1, Test_DB_2, Test_DB_3, you can use the following to get the result of all of their mailboxes:
$Mailboxes = (Get-MailboxDatabase Test_db_* | Get-Mailbox).Distinguishedname
Leave a comment