exporting all SMTP addresses from Exchange 2010

Posted on 2016-09-07
Last Modified: 2016-09-07
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
Question by:mwjones75
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
LVL 16

Expert Comment

by:Todd Nelson
ID: 41788071
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.

Author Comment

ID: 41788157
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
LVL 16

Accepted Solution

Todd Nelson earned 500 total points
ID: 41788173
Then you will want this to output one line for each user...

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

Open in new window

or this to output one line for each user's SMTP address...

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

Open in new window

I meant that the "EmailAddresses" parameter is an array, not PrimarySmtpAddress.
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!


Author Comment

ID: 41788786
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

Author Closing Comment

ID: 41788787
LVL 16

Expert Comment

by:Todd Nelson
ID: 41788829
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.

Featured Post

Edgartown IT Case Study

Learn about Edgartown's quest to ensure the safety and security of the entire town's employee and citizen data. Read the case study!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Lotus Notes – formerly IBM Notes – is an email client application, while IBM Domino (earlier Lotus Domino) is an email server. The client possesses a set of features that are even more advanced as compared to that of Outlook. Likewise, IBM Domino is…
This article explains in simple steps how to renew expiring Exchange Server Internal Transport Certificate.
In this Micro Video tutorial you will learn the basics about Database Availability Groups and How to configure one using a live Exchange Server Environment. The video tutorial explains the basics of the Exchange server Database Availability grou…
To add imagery to an HTML email signature, you have two options available to you. You can either add a logo/image by embedding it directly into the signature or hosting it externally and linking to it. The vast majority of email clients display l…

696 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question