Home > Exchange Server > one liners: Finding users with forwarding addresses set

one liners: Finding users with forwarding addresses set

Exchange 2013 logo 128x128Sometimes while implementing new corporate policies, such as those that control forwarding messages outside of an environment, an admin needs to figure out who is configured that way. This can be a daunting task to go down through every account, visually inspecting each. PowerShell comes to the rescue in this one liner:

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

As we see in our test, one user, Robert Sweet, is configured for forwarding. His account forwards to a contact called “Robert Sweet [External]”, and based on the Mailbox & Forward being False, we know that it only forwards to the external address, and does not also deliver to the Exchange mailbox.

If we needed to, we could use

Get-Contact "Robert Sweet [External]" | Format-List

to get info about the contact, including the destination SMTP address. If we need to disable forwarding for all of the enabled users, we can use

Get-Mailbox -Resultsize Unlimited | Where-Object {$_.ForwardingAddress -ne $null} | Set-Mailbox -ForwardingAddress $null
  1. aa
    February 25th, 2012 at 15:58 | #1

    is there any way to list all users who has -DeliverToMailboxAndForward $true

    and change it to -DeliverToMailboxAndForward $false using your above command?

    would this work?

    Get-Mailbox -Resultsize Unlimited | Where {$_.ForwardingAddress -ne $null} | Set-Mailbox -DeliverToMailboxAndForward $false

    • Pat Richard
      February 25th, 2012 at 16:01 | #2

      I don’t see any reason why that wouldn’t work.

  2. May 20th, 2015 at 20:42 | #3

    Have you written a script that looks inside the mailbox forwarding rules as well, to determine which users may not be using a full mailbox forward, but are still forwarding?

    • Pat Richard
      May 20th, 2015 at 20:43 | #4

      Sorry, I have not.

  1. No trackbacks yet.