Solved

exporting all SMTP addresses from Exchange 2010

Posted on 2016-09-07
6
43 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 15

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 15

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
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 

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 15

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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Follow this checklist to learn more about the 15 things you should never include in an email signature from personal quotes, animated gifs and out-of-date marketing content.
In-place Upgrading Dirsync to Azure AD Connect
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 an Accepted Domain 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 Mail Flow >> Ac…

808 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