Tuesday, May 30, 2023

Export PST from Mailbox

Exporting a mailbox from an Exchange server is sometimes easier to connect via an Outlook client and running an export from the menu. But that, like the import procedure in the previous article, is not simple when you want to export a whole load of them. To do this, you can use some simple Powershell commands.

This does work on Office 365 although you need to provide a local location for the PST to reside in. Connect to Office 365 via PowerShell first and run the commands below.

In the example below, we will export the mailbox for our user Joe and drop it out to a directory on the server that we can pickup the PST later.

New-MailboxExportRequest -Mailbox [email protected] -FilePath \\EXCH01\e$\PSTimport\JoeUser.PST

To make things more interesting, you can add some extra parameters to make the export a bit more granular. So in the example below we can export messages that have ‘finance’ or ‘money’ in the body and also received before Jan 01 2017.

New-MailboxExportRequest -Mailbox [email protected] -ContentFilter {(body -like “*finance*”) -and (body -like “*money*”) -and (Received -lt “01/01/2017”)} -FilePath \\EXCH01\e$\PSTimport\JoeUser.PST

Further to that, we can export particular folders, or exclude particular folders. Try out these two examples. The first includes the folder ‘Inbox’ and therefore will only export the Inbox. The second excludes the Calendar. If you want to include or exclude multiple folders, just add them in succession with a comma. For example -IncludeFolder “#Inbox#”,”#Calendar#”

New-MailboxExportRequest -Mailbox [email protected] -FilePath \\EXCH01\e$\PSTimport\JoeUser.PST -IncludeFolders “#Inbox#”

New-MailboxExportRequest -Mailbox [email protected] -FilePath \\EXCH01\e$\PSTimport\JoeUser.PST -ExcludeFolders “#Calendar#”

You can have multiple export requests running at the same time. To view what is running and see the status you can use the following commands.

Get-MailboxExportRequest | Get-MailboxExportRequestStatistics | ft

This will give you the full report on everything that is going on. Once a Mailbox export is completed, you can remove them from the system with this command

Get-MailboxExportRequest -status Completed | remove-mailboxexportrequest

Mark Rochester
Mark Rochesterhttps://thecloudgeezer.com
Mark currently works in the cloud space assisting large companies to migrate from either on premises to the cloud, or cloud to cloud. His experience with Enterprise migrations spans more than 25 years which basically makes him old. However, with all the oldness creeping up he still finds technology massively exciting. Please reach out for a chat anytime you would like. :-)

Related Articles


I am assuming that if you made it this far then you will already know a little bit around the importance of SPF, DKIM...

SharePoint Site/File Discovery Report

Getting a full list of every file in your organizations' Share Point environment can be difficult via the normal consoles and reports. What I...

Backup your Cloud Storage on a Local Drive

Having all your data in the cloud is a wonderful thing. BUT, sometimes you either want the peace of mind that you have a...

Stay Connected

- Advertisement -

Latest Articles