Knowledge Base

How to export a list of mailboxes to a CSV file


You need to export a list of mailboxes from an on-premises Exchange server or Exchange Online (Office 365) to a CSV file, for example, to use it with CodeTwo migration software.


There are two ways to prepare a CSV file listing all the mailboxes residing on an Exchange on-premises or Exchange Online server:


If you’re exporting the CSV file to use it in CodeTwo migration software when matching mailboxes, remember to add the target email address to each row. Learn more

Exporting the mailbox list by using cmdlets

  1. Start ems Exchange Management Shell (on-premises Exchange) or connect to the Exchange server remotely (Office 365).
  2. To get the list of all mailboxes hosted on your Exchange server, execute the following cmdlet:
    $mailboxes = Get-Mailbox -resultSize unlimited
  3. Export the list together with selected AD properties (in this case the user’s first and last name, display name and email address) to a CSV file by using the following cmdlet:
    $mailboxes | foreach { Get-User $_.UserPrincipalName | select FirstName, LastName, DisplayName, WindowsEmailAddress } | export-csv -NoTypeInformation .\Mailboxes.csv -Delimiter ";" -Encoding unicode

    The CSV file will be saved in a folder located in the same path from which the cmdlet was executed.

Exporting the mailbox list by using the Exchange admin center

On-premises Exchange

  1. Log in to the Exchange admin center as discussed in the instructions for Exchange Server 2019 and 2016 and Exchange Server 2013.

  2. Choose recipients from the feature panel. You will now see a list of all user mailboxes (Fig. 1.).

525-1-Exchange Admin Center on-prem
Fig. 1. User mailboxes shown in the Exchange admin center.

  1. To export this list to a CSV file, click the (ellipsis) button and from the drop-down menu choose Export data to a CSV file (Fig. 2.).

525 - 2 - Export mailboxes to CSV
Fig. 2. Exporting mailboxes to a CSV file.

  1. In the window that opens, tick checkboxes next to the user data you want to export (Fig. 3.). If you're going to use the CSV file in CodeTwo migration software, you need to export at least the user’s first and last name, email address and the display name.

525-3-choose properties to export
Fig. 3. Selecting the user data to be exported.

  1. Click the export button. The file will be downloaded to your local drive.

Exchange Online (Office 365)

  1. Sign in directly to the Exchange admin center or follow the instructions in this Microsoft article.
  2. Go to Recipients > Mailboxes (Fig. 4., item A).

Exporting user mailboxes from the Exchange admin center.
Fig. 4. Exporting user mailboxes from the Exchange admin center.

  1. Use the filter drop-down menu and the search box to display the mailboxes you want added to the CSV file (Fig. 4., item B). Only mailboxes that are displayed will be included in the CSV file.
  2. Click the Export button (Fig. 4., item C). The CSV file should start downloading immediately.

Was this information useful?