How to use New-MailboxExportRequest Powershell Command?

Exchange Server administrators, sometimes, need to export mailboxes from Exchange Server to PST files. Some common reasons include archiving old mailboxes, taking backup of mailbox of a leaver, and archiving an unwanted mailbox. To facilitate the export of mailboxes to PST, Exchange Server (2010 SP1 onwards) offers the New-MailboxExportRequest PowerShell command. Exporting mailboxes to PST using this PowerShell command is a better option than using the Exchange Admin Center (EAC) as it offers filtering options. You can also script a loop to export all mailboxes or a range of mailboxes at once. In this article, we will see how to use the New-MailboxExportRequest PowerShell command to export Exchange mailboxes to PST files.

Using the New-MailboxExportRequest Command to Export Mailboxes to PST

To run the New-MailboxExportRequest command, the user account must be assigned with the Mailbox Import Export role. You can use the Exchange Admin Center (EAC) to assign the required permissions. Follow the given steps:

  • Open the Exchange Admin Center (EAC). After login, click on Permissions and then admin roles.
Open the Exchange Admin Center (EAC)
  • Click the Add (+) button.
  • Enter the name for the group.
  • Click the Add (+) button under the Roles.
  • Find Mailbox Import Export and double click on it to add it to the list. Click OK.
Find Mailbox Import Export
  • Add the user to be used to export data in the Members area and click Save.
 export data in the Members area and click Save
Alternatively, you can use the following PowerShell command in the Exchange Management Shell (EMS) to assign the Mailbox Import Export role.
New-RoleGroup "Mailbox Import-Export Management" -Roles "Mailbox Import Export"

You can also assign the newly created role to the user or group by using the below command.

Add-RoleGroupMember "Mailbox Import-Export Management" -Member Administrator

Now, you need to create a share where you want to export the PST files and give the right permissions on it. After creating 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. You also need to add the Exchange Trusted Sub System to the permissions. These users must have full permissions on the folder and on the share.

PSTfiles property

Exporting the Mailboxes to PST

After fulfilling the above prerequisites, let's see how to use the New-MailboxExportRequest command.

NOTE: You can export all your Exchange mailboxes using this command. However, you cannot export public folders and disconnected mailboxes.

To export all the mailboxes to PST, you can use the following command:

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

Exporting the Mailboxes to PST

This will export the mailbox, named User1, to the share PST Files on EX01 server as User1.pst. 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. It will show the status of export as Completed, Failed, or In-Progress.

To export a specific folder or folders from the mailbox, you can use the include folders switch in the command (see the below example).

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

export more than one folder

To export more than one folder, you can separate them with a comma.

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

ExcludeFolders switch command

To exclude a particular folder, you can use the ExcludeFolders switch (see the below command). For excluding multiple folders, you can separate them with a comma.

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

export mailbox items to PST

By using the Content Filter parameter, you can export mailbox items to PST based on a specific date or a date range.

To export items till a particular date, you can use the command as given below:

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

The above command will export all the mailbox items till 1st January 2018.

To export items from a date onwards, you can use the gt switch (see the below example).

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

export mailbox data for a date range

To export mailbox data for a date range, you can combine the gt and lt switches (see the below example).

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

Suspend-MailboxExportRequest command

You can also suspend the export request which is in-progress, by using the Suspend-MailboxExportRequest command as given below.

Suspend-MailboxExportRequest -Identity "\"

To get the information about the identity, you can run the Get-MailboxExportRequest command.

To clean up the completed export requests, you can use the below command.

Get-MailboxExportRequest -Status Completed | Remove-MailboxExportRequest

This will clear all exports with the status completed.

If you want to remove the requests with the failed status, you can use the below command.

Get-MailboxExportRequest -Status Failed | Remove-MailboxExportRequest

To Conclude

Above, we have explained how to use the New-MailboxExportRequest command to export mailboxes to PST in Exchange Server. However, it has some limitations, such as mailbox must be online (not disconnected), export must be done one-by-one, running script to export all the mailboxes hinders the performance of the server, reporting is not accurate, and export from only mounted mailbox databases.

To overcome such limitations, you can use a third-party EDB to PST converter application, such as Stellar Convertor for EDB. It is an ideal tool for any Exchange Admin as it can open any type and version of Exchange databases - from Exchange 2007 till Exchange 2019. It can export mailboxes and other data to PST and other common formats, such as EML, MSG and PDF. It can also directly export the EDB data to a live Exchange Server or Microsoft 365 tenant.



Was this article helpful?
FAQs
A. Yes, you can export multiple mailboxes to PST at once. However, running multiple exports at once might hinder the performance of the server and affect the experience of the users.
A. You can use the Get-MailboxExportRequest command. It will display the export status as completed, failed, or in-progress.
A. The Get-MailboxExportRequest will show the information if an export request fails. An export request may fail due to problems with permissions on the share/Exchange Server or destination storage issues.
A. You can use the Remove-ExportRequest command to remove the export requests, depending on the status or by specifying the name of the export.
A. Yes, it’s the only available destination type. Ensure that the Exchange Trusted Subsystem must have full permissions on the folder and share.
A. When using the New-MailboxImportRequest command, you can consider the following: • The destination of the export will not be on the same server where the Exchange Server is. • Ensure there is enough disk space.
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