How to use New-MailboxExportRequest Powershell Command?

With the introduction of PowerShell, Microsoft has added the ability to export mailboxes from Exchange Server to PST files. The main reason to export to PST is usually for archiving old mailboxes. The other reason may be a leaver or an unwanted mailbox in your Exchange server but you still want to keep the data. From Exchange Server 2010 SP1 onwards, you can use the command natively. However, if you are running an Exchange 2007, you must have another machine with Windows 7 Professional 32-bit installed, with Office 32-bit installed along with the Exchange Management Tools.

Note: If you are still running Exchange Server 2007, you should migrate to Exchange 2013 or higher as soon as possible as it was out of support and end of life for ages. Exchange Server 2010 has reached its end of life and support in January 2020.

Requirements Permissions

You will need the right permissions to export the data. Your user must be given the Mailbox Import Export role. This can be done from the Exchange Admin Center (EAC), by following the given steps:

  • After login, click on Permissions and then admin roles

  • Click the + button
  • Enter the name for the group example Import Export
  • Click the + button under the Roles
  • Find the Mailbox Import Export and double click on it to add it to the list
  • Click OK

  • Add the user who will be used to export data in the Members area and click Save

Shared Location

To export to PST by using the New-MailboxExportRequest, you need to create a share where you want to export the PST files. You cannot export your PST files, for example, to D:\PSTFiles.You need to create a share on the server or PC to export to, for example,\\EX01\PSTFiles and give the right permissions on it.

After you created the folder where you want to export your PST files, you need to share the folder with the user that has the Import/Export role. Besides, you also need to add the Exchange Trusted Sub System to the permissions. These two users must have full permissions on the folder and on the share (seethe screenshot below).

Exporting the Mailboxes to PST

By using New-MailboxExportRequest command, you can export all your Exchange mailboxes. However, you cannot export public folders disconnected mailboxes. Disconnected mailboxes are mailboxes which have been deleted. A disconnected mailbox is a mailbox without a user. To export a disconnected mailbox, you need to create a new AD user and connect the mailbox to that user. After that you will be able to export it.

So, let's start off with something simple and export all the mailboxes to PST. This can be done using the following command.

New-MailboxExportRequest -Mailbox User1 -FilePath \\EX01\PSTFiles\User1.pst

This will export the mailbox User1 to the share PST Files on EX01 server as User1.pst. This will export all the mailboxes. Depending on the size of the mailbox, it will take some time to finish.

You can see the progress of the export by using the Get-MailboxExportRequest cmdlet, as below.

It shows the status of export as Completed, Failed and In-Progress.

Include and Exclude Folders

To export a specific folder or folders from the mailbox, you would need to use the switch include folders as below:

New-MailboxExportRequest -Mailbox User1 -FilePath \\EX01\PSTFiles\User1.pst-IncludeFolders "#Inbox#"

To export more than one folder, you would need to separate them with a comma as below:

New-MailboxExportRequest -Mailbox User1 -FilePath \\EX01\PSTFiles\User1.pst-IncludeFolders "#Inbox#", "#Sent Items#"

To make a PST export and exclude a particular folder, use the excludefolders switch as below. For excluding multiple folders, just add them separated with a comma.

New-MailboxExportRequest -Mailbox User1 -FilePath \\EX01\PSTFiles\User1.pst-ExludeFolders "#Inbox#", "#Sent Items#"

Export by Date to/from or Range

By using the Content Filter, you can export mailbox items to PST by selecting a specific date, from a specific date onwards or a date range. Let's explore the three options.

Exporting from a date backwards, we need to use the command as below:

New-MailboxExportRequest -ContentFilter {(Received -lt '01/01/2018')} -Mailbox User1 -Filepath \\EX01\PSTFiles\User1lt.pst

By using the switch lt, the above example will export all mailbox items before 1st January 2019. To export from a date onwards, we need to use gt switch as below:

New-MailboxExportRequest -ContentFilter {(Received -gt '01/01/2018')} -Mailbox User1 -Filepath \\EX01\PSTFiles\User1lt.pst

To export mailbox data for a date range, for example all data between 2019 and 2020, you need to combine the switches gt and lt as below.

New-MailboxExportRequest -ContentFilter {(Received -lt '01/01/2020')-and (Received -gt '01/01/2019')} -Mailbox User1 -Filepath \\EX01\PSTFiles\User1range.pst

As you can see, the command has several filtering rules that you can apply.

This concludes the tutorial on how to export a PST from your Exchange Server using the New-MailboxExportRequest. However, there might be some limitations and issues with this method.

  • The mailbox must be online (not disconnected)
  • Not a big range of filtering
  •  Export must be done one-by-one
  • Although with Power Shell, you can do a script to run all the mailboxes, but this will hinder the performance of the server.
  • Reporting is not accurate
  • Can only export from mounted Mailbox databases

An alternative to the New-MailboxExportRequest command is to use a third-party EDB to PST Converter application. Stellar Convertor for EDB is the ideal partner of any Exchange Admin as it can open any type and version of Exchange databases from Exchange 2007 till Exchange 2019. The database can be either Online or Offline. You can export data to PST and other common formats such as EML, MSG and PDF. You can also directly export to a live Exchange Server or to an Microsoft 365 tenant.



Was this article helpful?
About The Author
author image
Ravi Singh linkdin Icon

Senior Writer at Stellar®. He is an expert Tech Explainer.

Table of Contents

WHY STELLAR® IS GLOBAL LEADER

Why Choose Stellar?
  • 0M+

    Customers

  • 0+

    Years of Excellence

  • 0+

    R&D Engineers

  • 0+

    Countries

  • 0+

    PARTNERS

  • 0+

    Awards Received