…covering cloud technologies such as Office 365, Azure, Amazon and, of course, SharePoint

Who has forwarding enabled in their Exchange Online mailbox??

June 18, 2013 by Greg Carnie

How do I know, without looking at the properties of every Exchange Online mailbox, which users have setup mail forwarding on their mailbox?  That is a very good question.  If you Google around you’ll find lots of interesting answers, particularly around using LDAP queries to identify those mailboxes - but how do you do that in Exchange Online???  PowerShell is the answer!

First, here is how you connect to your Exchange Online tenant: http://technet.microsoft.com/en-us/library/jj984289(v=exchg.150).aspx.

Second, run this command:

Get-Mailbox -Filter {ForwardingSmtpAddress -ne $null}

That will give you a list of all the users that have enabled (or have a not null) forwarding address configured.  Taking this one step further you can grab the user and the destination address by using this command:

Get-Mailbox -Filter {ForwardingSmtpAddress -ne $null} | foreach {$recipient = $_; $forwardingsmtp = (Get-Recipient $_.ForwardingAddress).PrimarySmtpAddress; Write-Host $recipient.Name, $_.ForwardingSmtpAddress }

Ultimately you’d probably want to put this in a script of it’s own an pipe the results to a text file for further analysis.

Lastly, don’t forget to disconnect your PowerShell session - remember, you can only have 3 open sessions to Exchange Online.


Written by Greg Carnie

I am a SharePoint consultant (Business Analyst by title) with Ideaca Knowledge Services based in Toronto, Canada. I have been actively working with SharePoint for three years now and have been specializing more in the developmental and architectural aspects of SharePoint. In a previous life I worked both with SAP and Microsoft Exchange. In my spare time (yes – I have figured out how to have a life outside of SharePoint – only took 3 years!!) I read, have started to get myself back into decent shape, and intend to spend a significant amount of time outside this summer.

You should follow Greg on Twitter