Home > Exchange Server, PowerShell > One liners: Get All Exchange Users Who Are Configured for Forwarding

One liners: Get All Exchange Users Who Are Configured for Forwarding

Exchange 2013 logo 128x128Due to some legal requirements, I had a needed to list all users who were configured in Exchange to forward elsewhere. This was to ensure that mail wasn’t automatically leaving the environment. A simple, single line in the shell is all that’s needed to give me what I need.

Open Exchange Management Shell, and enter this:

Get-Mailbox -Resultsize Unlimited | Where-Object {$_.ForwardingAddress}

We can clean this up and make it a little more presentable using something like:

Get-Mailbox -Resultsize Unlimited | Where-Object {$_.ForwardingAddress} | Select-Object Name, @{Expression={$_.ForwardingAddress};Label="Forwarded to"}, @{Expression={$_.DeliverToMailboxAndForward};Label="Mailbox & Forward"}

And the results are a small table that shows the user name, which object mail is being forwarded to, and whether the mailbox is configured to both store and forward:

forwardedusers

This allowed me to take a look at those user accounts, and disable the forwarding, forcing the users to use their Exchange mailbox.

For a long list, or if you just want the info in a file, we can export the results to a .csv using Export-Csv. To do this, use:

Get-Mailbox -Resultsize Unlimited | Where-Object {$_.ForwardingAddress -ne $null} | Select-Object Name, @{Expression={$_.ForwardingAddress};Label="Forwarded to"}, @{Expression={$_.DeliverToMailboxAndForward};Label="Mailbox & Forward"} | Export-Csv c:\forwardedusers.csv -NoTypeInformation
  1. September 1st, 2014 at 05:28 | #1

    Although…the list is incomplete 🙁

    • Pat Richard
      September 18th, 2014 at 15:12 | #2

      Can you explain? My testing shows that it’s correct.

  2. January 28th, 2015 at 13:43 | #3

    His list was to long. (as is my own) You cant scroll to the beginning of the list. I just reran it and stopped it when I found the user I was looking for.

  3. John
    January 3rd, 2016 at 20:30 | #4

    Hi, is there a way to return the SMTP address within the contact?

  1. No trackbacks yet.