Skip to main content

Summary

Finding unusual mail rules.

EXO forwards

Get-Mailbox -ResultSize Unlimited | Where {($_.ForwardingAddress -ne $Null) -or ($_.ForwardingsmtpAddress -ne $Null)} | Select Name, ForwardingAddress,ForwardingsmtpAddress, DeliverToMailboxAndForward

or, skipping internal forwards

Get-Mailbox -ResultSize Unlimited | Where {($_.ForwardingsmtpAddress -ne $Null)} | Select Name, ForwardingAddress,ForwardingsmtpAddress, DeliverToMailboxAndForward

Transport rules

Get-TransportRule | Select Name, Description | FL

Mega-check user rules

$mailboxes=(get-mailbox).UserPrincipalName;foreach ($mailbox in $mailboxes) {get-inboxrule -Mailbox $mailbox | Select Identity, Name, Description, ForwardTo | FL}

remove -

Remove-InboxRule -Mailbox <id> -Identity “rulename”