Exporting email addresses into .CSV of around 20 mailboxes?

Posted on 2016-07-27
Last Modified: 2016-08-05
Hi guys,

If we wanted to export the email addresses of lets say around 20 mailboxes into a .CSV, how would we do that in Exchange 2010 shell?

For example, if we have a list of the name of the mailboxes like the below, then what would be the best way to export their email addresses without having to do each one individually?


Thanks a lot
Question by:Yashy
LVL 16

Accepted Solution

FOX earned 250 total points
ID: 41731634
If you have the list of users/mailboxes in a list.   Name the list mailboxes.txt  Your exchange shell command will be

 Get-Content "c:\filepath\mailboxes.txt" | Get-Mailbox | Ft SamAccountName, EmailAddress | out-file "c:\temp\emailaddresses.csv"
LVL 11

Assisted Solution

by:Tej Pratap Shukla ~Dexter
Tej Pratap Shukla ~Dexter earned 125 total points
ID: 41732432
Run below command in EMS to export email addresses to CSV file:
Get-Mailbox -ResultSize Unlimited |Select-Object DisplayName,ServerName,PrimarySmtpAddress, @{Name=“EmailAddresses”;Expression={$_.EmailAddresses |Where-Object {$_.PrefixString -ceq “smtp”} | ForEach-Object {$_.SmtpAddress}}} | Export-Csv c:\mailbox_alias.csv

Open in new window


Author Comment

ID: 41733122
Fabulous guys, thanks for your help.
LVL 14

Assisted Solution

by:Todd Nelson
Todd Nelson earned 125 total points
ID: 41733292
First, create a CSV file with a list of the users you want to output email addresses for.  I called the file "MailboxList.csv".  The CSV must have a header and look similar to this...


Next run these two commands...

The first will import the information using "MailboxList.csv" into an array.

$MyAddresses = Import-Csv "C:\MailboxList.csv" | ForEach-Object { Get-Recipient -Identity $_.Mailboxes | select Name, Alias, PrimarySmtpAddress }

The second will use the array to output the name, alias and primary email address into a CSV file for each of the users you provided in "MailboxList.csv".

$MyAddresses | Export-Csv "C:\MyEmailAddresses.csv" -NoTypeInformation

Hope this helps.

Featured Post

VMware Disaster Recovery and Data Protection

In this expert guide, you’ll learn about the components of a Modern Data Center. You will use cases for the value-added capabilities of Veeam®, including combining backup and replication for VMware disaster recovery and using replication for data center migration.

Question has a verified solution.

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

Large Outlook files lead to various unwanted errors and corruption issues. Furthermore, large outlook files can also make Outlook take longer to start-up, search, navigate, and shut-down. So, In this article, i will discuss a method to make your Out…
This article aims to explain the working of CircularLogArchiver. This tool was designed to solve the buildup of log file in cases where systems do not support circular logging or where circular logging is not enabled
This tutorial will walk an individual through the process of configuring their Windows Server 2012 domain controller to synchronize its time with a trusted, external resource. Use Google, Bing, or other preferred search engine to locate trusted NTP …
The basic steps you have just learned will be implemented in this video. The basic steps are shown to configure an Exchange DAG in a live working Exchange Server Environment and manage the same (Exchange Server 2010 Software is used in a Windows Ser…

896 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

14 Experts available now in Live!

Get 1:1 Help Now