Dump All Proxy Address/Email Addresses from Exchange Server using PowerShell.
Mailboxes –
Get-Mailbox -ResultSize Unlimited | Select-Object DisplayName,Servername,EmailAddressPolicyEnabled,PrimarysmtpAddress, @{Name="EmailAddresses";Expression={$_.EmailAddresses | Where-object {$_.PrefixString -ceq "smtp"} |Foreach-object {$_.SmtpAddress}}} | Export-Csv EmailAddresses_MBX_Dump.csv
Distribution Groups –
Get-DistributionGroup -ResultSize Unlimited | Select-Object DisplayName,Servername,EmailAddressPolicyEnabled,PrimarysmtpAddress, @{Name="EmailAddresses";Expression={$_.EmailAddresses | Where-object {$_.PrefixString -ceq "smtp"} |Foreach-object {$_.SmtpAddress}}} | Export-Csv EmailAddresses_DG_Dump.csv
Mail Contacts –
Get-MailContact -ResultSize Unlimited | Select-Object DisplayName,Servername,EmailAddressPolicyEnabled,PrimarysmtpAddress, @{Name="EmailAddresses";Expression={$_.EmailAddresses | Where-object {$_.PrefixString -ceq "smtp"} |Foreach-object {$_.SmtpAddress}}} | Export-Csv EmailAddresses_Contact_Dump.csv
you can create a CSV as below,
You can try also:
Get-Recipient -ResultSize Unlimited | Select-Object RecipientType, DisplayName,Servername,EmailAddressPolicyEnabled,PrimarysmtpAddress,EmailAddresses | Export-CliXml RecipientsDump.xml
does almost the same. Import-CliXml allows to work “offline” with this dump then.
This doesn’t work for exchange online. Any way to make it work for Exchange Online where it will dump the proxy addresses?