Sunday, September 25, 2022

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 -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 -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 -FilePath \\EXCH01\e$\PSTimport\JoeUser.PST -IncludeFolders “#Inbox#”

New-MailboxExportRequest -Mailbox -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 Rochester
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

Microsoft 365 Discovery Report

If you are working with a Microsoft 365 tenant, whether it is for your own or for a client, it is often necessary to...

Active Directory (AD) HTML Report

This report creates a very nice looking HTML report that can be used directly to report to clients with not much editing. Run on...

Active Directory Report (ADRecon)

This report runs on any locally connected machine and creates a beautiful report on the Active Driectory structure that it finds, as you can...

Stay Connected

- Advertisement -

Latest Articles