Saturday, November 9, 2024

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

New-MailboxExportRequest -Mailbox JoeUser@domain.com -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

Microsoft 365 Discovery Report

Overview The Microsoft 365 Discovery Report is a collection of outputs from the various workloads inside a Microsoft 365 tenant, all consolidated into a single...

Migrate Microsoft 365 Mailboxes to Google Workspace

This is not a very common subject to talk about as most of the migrations that get performed are people moving into the Microsoft...

Batches Paused in ‘Needs Approval’ Status

When you are using the native Microsoft tools to migrate from Google Workspace (Gmail) into Microsoft 365 the tool works very well. It does...

Stay Connected

88FansLike
36,999FollowersFollow
32,381SubscribersSubscribe
- Advertisement -

Latest Articles