Saturday, February 4, 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

Migrate Microsoft Teams using MigrationWiz

As there is no native way to migrate the content from Tenant to Tenant for Microsoft Teams we need to use a paid toolset...

Migrate Microsoft 365 Tenant to Tenant with Free Native Tools

An interesting topic again, debating whether the free native tools that are available to migrate the Exchange Online workload in Microsoft 365 are good...

Create ‘Dummy Test’ Users in Local Active Directory

The need for this comes along when you are testing things like Azure AD Connect Sync, or an AD to AD migration. Maybe an...

Stay Connected

82FansLike
37,255FollowersFollow
685SubscribersSubscribe
- Advertisement -

Latest Articles