Skip to content

Instantly share code, notes, and snippets.

@micmaher
Created March 31, 2016 20:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save micmaher/e105f8fa29e05f17a15e355514ed99ea to your computer and use it in GitHub Desktop.
Save micmaher/e105f8fa29e05f17a15e355514ed99ea to your computer and use it in GitHub Desktop.
Gets mailboxes that have forwarders in place, the contact they use, the contacts address and if Store and Forward is on
# Gets mailboxes that have forwarders in place, the contact they use, the contacts address and if Store and Forward is on
$fwds = get-mailbox -ResultSize Unlimited | Where-Object { $_.ForwardingAddress -ne $null } | select Name, Alias, ForwardingAddress
foreach ($fwd in $fwds) {
$fwd | add-member -membertype noteproperty -name "ContactAddress" -value (get-contact $fwd.ForwardingAddress).WindowsEmailAddress
}
Write-Output $fwds | Format-Table -Autosize | Out-String -Width 10000 | Out-File -FilePath c:\temp\output.txt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment