List All Office 365 Mailboxes with Forwards via PowerShell

This is a really simple PowerShell script which will list all mailboxes on Office 365 with Forwards configured.

$UserCredential = Get-Credential

$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://outlook.office365.com/powershell-liveid/ -Credential $UserCredential -Authentication Basic -AllowRedirection

Import-PSSession $Session -DisableNameChecking

Get-Mailbox | Where {($_.ForwardingSMTPAddress -ne $null) -or ($_.ForwardingAddress -ne $null)} | Select Name, ForwardingSMTPAddress, ForwardingAddress, DeliverToMailboxAndForward

Tagged : / / /

Leave a Reply

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