How To Export Exchange Mailboxes To PST File Using PowerShell Cmdlet

You may need to export Exchange Server mailboxes to PST for various reasons, such as taking backup of a mailbox of before deleting the account, archiving mailboxes to a local file, having issues with a mailbox, migrating to Office 365, etc. There are three methods to export exchange mailboxes to PST, which are mentioned below.
  • Export mailboxes by using PowerShell
  • Export mailboxes by using Exchange Admin Center (EAC)
  • Export mailboxes by using Outlook
In this article, we will be discussing the procedure of exporting Exchange mailboxes by using PowerShell cmdlets as it is the best way to export to PST by using native tools. For this, you need to first open the Exchange Management Shell from the Exchange Server or from another computer which has the Exchange Management Tools installed.
Once opened, use the PowerShell cmdlet New-MailboxExportRequest to export the mailboxes. But before moving on, you need ensure the following prerequisites:
  • Get the necessary permissions
  • Setup a file share for the export
To setup the necessary permissions, you need grant the Import/Export role to the user which will extract the data from the Exchange Administrator. This can be given via the Exchange Admin Center (EAC) or PowerShell.
To setup permissions via EAC, follow the given steps,
  • In the Exchange Admin Center (EAC), click on Permissions and Admin roles.
  • Click on the + button to create a new role.
  • Assign the role of Import/Export to the user you will be using to export the mailboxes.
To assign permissions by using PowerShell, execute the following commands in the Exchange Management Shell.
New-ManagementRoleAssignment –Role "Mailbox Import Export" –User "<Username>"
New-ManagementRoleAssignment -Role "Mailbox Import Export" -SecurityGroup "Organization Management" -Name "Import Export"

File Share Setup

You need to setup a file share because you cannot just plug in a USB drive or a NAS and export to the drive letter directly. The New-MailboxExportRequest only supports exporting to a UNC path. So, if you want to export a mailbox, you need to use a network path. To do so, you need to first create the folder and then give the necessary permissions.
After you have created the folder,
  • Right-click on the folder and click on Share With.
  • Click on the search user and look for Exchange Trusted Subsystem.
  • Then, set the user permissions as Read/Write.

Exporting the Mailboxes

As said, to export a mailbox, you need to use the New-MailboxExportRequest PowerShell cmdlet.
To export a mailbox with no parameters, specify the user and the network path to export the PST (see the below example).
New-MailboxExportRequest -mailbox user1 -filepath "\\ExchangeServer\PST_Export\UserExport1.pst"
This will start the process of exporting the mailbox and the job will be queued. To see the status of export, you can run the Get-MailboxExportRequest on its own. It will show the status as in-progress, completed, or failed.
The given command will export all the mailboxes. However, if you want to export selective items, you can use some criteria, such as,
  • Folders include/exclude
  • Date range
Folders Include/Exclude
To export only a specific folder, you need to use the -IncludeFolders parameter in the export command (see the below example).
New-MailboxExportRequest -Mailbox 'user-a ' -Filepath "\\Exchange\PST_Export\User-a.pst " -IncludeFolders "#Inbox# ", "#Outbox# "
This will only export the folder's Inbox and Outbox. Now, if you want to export the entire mailbox, excluding some specific folders, you can use the -Excludefolders parameter (see the below example).
New-MailboxExportRequest -Mailbox 'user-a ' -Filepath "\\Exchange\PST_Export\User-a.pst " -ExcludeFolders "#Spam# ", "#Outbox# "
This will export the entire mailbox of the specific user, without Spam and Outbox folders.
Date Range
If you want to export items based on a date range, there are three options. You can export anything before a date, export anything after a date, or export anything between two dates. To do so, you need to use the -ContentFilter switch, with the lt (less than) and gt (greater than) parameters. Let’s see some examples.
Exporting all emails before 1st January 2020
New-MailboxExportRequest -ContentFilter {(Received -lt '01/01/2020')} -Mailbox vuser-a ' -Filepath "\\Exchange\PST_Export\user-a.pst "
Exporting all emails after 1st January 2020.
New-MailboxExportRequest -ContentFilter {(Received -gt '01/01/2020')} -Mailbox vuser-a ' -Filepath "\\Exchange\PST_Export\user-a.pst "
Exporting all emails from 1st January 2020 till 1st July 2020.
New-MailboxExportRequest -ContentFilter {(Received -lt '01/07/2020') -and (Received -gt '01/01/2020'} -Mailbox 'user-a ' -Filepath "\\Exchange\PST_Export\user-a.pst "
You can also combine both date and folder parameters (see the example below).
New-MailboxExportRequest -ContentFilter {(Received -gt '01/01/2020') -and (Received -gt '01/07/2020')} -IncludeFolders "#Inbox#" -Mailbox "td1" -FilePath "\\localhost\c$\PSTFiles\td1_3.pst"


There are some limitations of using PowerShell to export the Exchange mailboxes. You need to use scripting to export more than one mailbox at a time. This method could hinder the performance of your Exchange Server while exporting a large number of mailboxes at a time. To use PowerShell, your Exchange Server must be online and working.
As an alternative, you can use a specialized EDB to PST converter tool such as Stellar Converter for EDB. The software can easily open an offline EDB file from any version of Exchange Server without having a working Exchange Server. It converts the file and export the data to PST and other formats. It can also export directly to a live Exchange Server database or Office 365 tenant. This small, fast, and efficient application is an ideal tool for any Exchange Server admin.