one liners: Finding users with forwarding addresses set
Sometimes 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
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
I don’t see any reason why that wouldn’t work.
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?
Sorry, I have not.