Search O365 Exchange Forward Rules

IT and the Legal team recently started working on correcting several key issues. One of those included the ability to keep company email from auto forwarding out to other non-company accounts/companies/etc.

Open a powershell prompt (run as administrator)
$LiveCred = Get-Credential
$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://ps.outlook.com/powershell/ -Credential $LiveCred -Authentication Basic -AllowRedirection
Import-PSSession $Session
foreach ($i in (Get-Mailbox -ResultSize unlimited)) { Get-InboxRule -Mailbox $i.DistinguishedName | where {$_.ForwardTo} | fl MailboxOwnerID,Name,ForwardTo >> c:\text\Forward_Rule_list.txt }

If you receive an error “Files cannot be loaded because running scripts is disabled on this system”
Set-ExecutionPolicy RemoteSigned

Leave a Reply

Your email address will not be published. Required fields are marked *