One liners: Get All Exchange Users Who Are Configured for Forwarding
Due 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:
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
Although…the list is incomplete 🙁
Can you explain? My testing shows that it’s correct.
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.
Hi, is there a way to return the SMTP address within the contact?