Solved

exporting all SMTP addresses from Exchange 2010

Posted on 2016-09-07
6
56 Views
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
0
Comment
Question by:mwjones75
[X]
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
6 Comments
 
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.
0
 

Author Comment

by:mwjones75
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
0
 
LVL 16

Accepted Solution

by:
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.
0
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

by:mwjones75
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
0
 

Author Closing Comment

by:mwjones75
ID: 41788787
thanks!
0
 
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.

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

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