Export Exchange mailboxes to PST

With the included Exchange Management Shell you can easily export mailboxes to a PST file. A manual can be found here ūüôā

raphaelsilva / Pixabay

To be able to start, the user must be authorized to export the mailboxes.

The user must have the role RBAC to be able to export.
This is done with the following command

New-ManagementRoleAssignment -Role "Mailbox Import Export" -User "Administrator" -Role "Mailbox Import Export" -User "Administrator" -RoleAssignment

After executing the command, the Exchange Management Shell must be closed and reopened.

Export of a single mailbox

To export a single mailbox you need the following command,

get-mailbox youruser | New-MailboxExportRequest -FilePath "\yourserveryourshare$Exportyouruser.pst"

Note 1: Only “.pst” can be used as file format for the export (but can be opened with Outlook)
Note 2: A share ( UNC – path ) MUST be used as path, a path “C:export” does not work.

Displaying the Status of the Export

Exporting large mailboxes can take a while. To display the status, you must do the following:

Get-MailboxExportRequest | fl

Export of all mailboxes of a database

In order to export not only one mailbox, but all mailboxes, not much effort is necessary. Of course, not every mailbox has to be exported individually. That would be in an environment of for example500 users eeeeewig last ūüėČ

get-mailbox -Database yourdatabase | foreach {New-MailboxExportRequest -Mailbox $_.Alias -FilePath "\yourserveryourshare$Export$_.pst"}

Export single archive mailbox

Archive – mailboxes can also be exported to a “.pst” file

get-mailbox youruser -Archive | New-MailboxExportRequest -FilePath "\yourserveryourshare$Exportyouruser_archive.pst"

Export all archive mailboxes of a database

get-mailbox -Database yourdatabase -Archive | foreach {New-MailboxExportRequest -Mailbox $_.Alias -FilePath "\yourserveryourshare$Export$_.pst"}

Exporting Individual Shared Mailboxes

Shared mailboxes can of course also be exported, they are treated like “normal” user mailboxes.

get-mailbox info | New-MailboxExportRequest -FilePath "\yourserveryourshare$Exportinfo_shared.pst"

Export all shared mailboxes

get-mailbox -database yourdatabase | where {$_.RecipientTypeDetails -match "SharedMailbox"} | foreach {New MailboxExportRequest - Mailbox $_.Alias -FilePath "\yourserveryourshare$Export$_.pst"}

Export only certain data from a mailbox

If you only want to export certain folders or data from mailboxes, you should set the parameter

-IncludeFolders %data%

to the export command. Here is an example:

get-mailbox youruser | New-MailboxExportRequest -FilePath "\yourserveryourshare$Exportyouruser_kontakte.pst" -IncludeFolders Contacts
get-mailbox youruser | New-MailboxExportRequest -FilePath 
"\yourserveryourshare$Exportyouruser_calendar.pst"-IncludeFolders Calendar

Remove Export Request

After the data has been exported, the export request can now be deleted. To delete all requests, use the following command:

Get-MailboxExportRequest | Remove-MailboxExportRequest

The PST files are of course not touched by this action ūüôā

More information about Microsoft Exchange can be found at https://products.office.com/de-de/exchange/email

Christian Gebhardt