How to export a list of mailboxes to a CSV file

Problem:

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.

Solution:

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

Tip

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 $_ | 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

  1. Log in to the Exchange admin center:

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

525-1
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
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
Fig. 3. Selecting the user data to be exported.

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