Use the following steps to check for any Office 365 auto-forward rules to external email addresses.
In this blogpost I’m using Powershell to check for any existing auto-forward rules to external email addresses.
Step 1 Logon to Office 365 using Powershell
|
1 2 |
$cred=get-credential $session=new-pssession –configuration Microsoft.Exchange –connectionURI https://ps.outlook.com/powershell –authentication BASIC –allowRedirection:$TRUE –credential $credimport-psSession $session |
Step 2 Export the mailbox(es) that have either redirect or forwarding
This produces a list of all mailboxes that exist in the organization where the forwaring or redirect flags are enabled
|
1 2 3 |
$mailboxes=get-mailbox –resultSize unlimited $rules = $mailboxes | foreach { get-inboxRule –mailbox $_.alias } $rules | where { ( $_.forwardAsAttachmentTo –ne $NULL ) –or ( $_.forwardTo –ne $NULL ) –or ( $_.redirectTo –ne $NULL ) } | ft name,identity,ruleidentity |
Step 3 Investigate which rules are in use
|
1 |
Get-InboxRule –identity “username” | fl name,forwardTo,forwardAsAttchmentTo,redirectTo |
Step 4 Remove the inbox rule from a specific mailbox
|
1 |
Get-InboxRule -Mailbox username | Remove-InboxRule |
Step 5 Remove all the available inbox rules from all mailboxes (if you prefer)
|
1 2 3 4 5 6 7 |
$mbxs = Get-Mailbox foreach ($mbx in $mbxs) { Get-InboxRule -Mailbox $($mbx.Alias) | Remove-InboxRule } |