Link to home
Start Free TrialLog in
Avatar of mwjones75
mwjones75

asked on

exporting all SMTP addresses from Exchange 2010

Hello Everyone...  I have a script that I have used in the past that is now not giving me the Email addresses listed in the output under SMTP Adresses is blank......and am wondering if someone can see what I am doing wrong...

Get-mailbox -resultsize Unlimited | Select Name,PrimarySMTPAddress, RecipientTypeDetails, HiddenFromAddressListsEnabled  -ExpandProperty EmailAddresses | Select Name, PrimarySMTPAddress, RecipientTypeDetails, HiddenFromAddressListsEnabled, SmtpAddress | Export-csv c:\temp\mark\smtpmbx09072016.csv
Avatar of Todd Nelson
Todd Nelson
Flag of United States of America image

If a parameter has an array value (like PrimarySmtpAddress does) then an "expression" statement needs to be made for the output to be written correctly.

Using your command, I made a modification for you to try...

Get-Mailbox -ResultSize Unlimited | Select-Object Name,@{Expression={$_.PrimarySMTPAddress};Label="PrimarySMTPAddress"},RecipientTypeDetails,HiddenFromAddressListsEnabled | Export-Csv "c:\temp\mark\smtpmbx09072016.csv" -NoTypeInformation

Open in new window


FYI... There is no SmtpAddress parameter for Get-Mailbox.
Avatar of mwjones75
mwjones75

ASKER

thank you...  I am however trying to get all SMTP addresses.  I want to specify which is primary but want to pull All email addresses associated with each mailbox or recipient
ASKER CERTIFIED SOLUTION
Avatar of Todd Nelson
Todd Nelson
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thanks for this...  I ended up needing to tweak a little but got what I needed ....  had to go to recipients because we are now in Hybrid mode and the mailboxes that have been migrated dont show up under get-mailbox

[PS] C:\temp\Mark>Get-recipient -resultsize Unlimited | Select Name, PrimarySMTPAddress, RecipientTypeDetails, HiddenFromAddressListsEnabled -ExpandProperty EmailAddresses | Select Name, PrimarySMTPAddress, RecipientTypeDetails, HiddenFromAddressListsEnabled, SmtpAddress | Export-csv c:\temp\mark\smtpmbx0907.csv
thanks!
Nice!  I'll have to test your command out.

If you connect to Office 365 using PowerShell you can use Get-Mailbox for those specific mailboxes.

https://oddytee.wordpress.com/2013/03/21/connect-to-office-365-with-powershell/