Solved

exporting all SMTP addresses from Exchange 2010

Posted on 2016-09-07
6
37 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
  • 3
  • 3
6 Comments
 
LVL 14

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 14

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
Want to promote your upcoming event?

Are you going to an event? Are you going to be exhibiting at a tradeshow? Talking at a conference? Using a promotional banner in your email signature ensures that your organization’s most important contacts stay in the know and can potentially spread the word about the event.

 

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 14

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

Are your AD admin tools letting you down?

Managing Active Directory can get complicated.  Often, the native tools for managing AD are just not up to the task.  The largest Active Directory installations in the world have relied on one tool to manage their day-to-day administration tasks: Hyena. Start your trial today.

Question has a verified solution.

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

Local Continuous Replication is a cost effective and quick way of backing up Exchange server data. The following article describes the steps required to configure Local Continuous Replication. Also, the article tells you how to restore from a backup…
Marketers need statistics and metrics like everybody else needs oxygen. In this article we explain how to enable marketing campaign statistics for Microsoft Exchange mail.
In this video we show how to create a User Mailbox in Exchange 2013. We show this process by using the Exchange Admin Center. Log into Exchange Admin Center.: First we need to log into the Exchange Admin Center. Navigate to the Recipients >> Mailb…
In this video we show how to create a Distribution Group in Exchange 2013. We show this process by using the Exchange Admin Center. Log into Exchange Admin Center.: First we need to log into the Exchange Admin Center. Navigate to the Recipients >>…

912 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

Need Help in Real-Time?

Connect with top rated Experts

28 Experts available now in Live!

Get 1:1 Help Now