Exporting mailboxes to PST is a well-known workaround for Exchange mailbox backup, archive and migration. The video below shows all the steps required to export emails, contacts, calendars and other mailbox items to PST (Personal Storage Table) files.
Transcription of the video
Exporting mailboxes to PST is native Exchange Server’s answer to the question of archiving and manual migration to another server.
PST files are not very reliable, but they are still widely used. So in this video I show how to export Exchange mailbox data to PST.
You can export mailboxes in Outlook, using the Exchange admin center, or with PowerShell. Let’s skip the first two methods and see how to do this using PowerShell.
All the cmdlets I use are listed under.
First, I assign the Mailbox Import Export role to my account.
Then I run the New-MailboxExportRequest cmdlet to export This mailbox to This shared folder.
As a result, I get a PST file with all items from the specified mailbox. With additional attributes I can limit the number of items exported. For example, I can export only the Inbox folder, exclude items from the Spam and Deleted Items folders, or only export items less than a month old.
Bulk export is just as easy. First you need to get the list of mailboxes that you want to export. You can use Get-Mailbox or Get-ADGroupMember to generate this list and move it to a variable. Then paste the export script and point it to a shared folder.
I get a PST file for each mailbox listed.
Note that you should not use PST files for migration or backup purpose if you have other choice as this method is fatally buggy and error prone. You can learn more about migration and backup with PST files by clicking this link.
Cmdlets used in the video
Assign Mailbox Import Export role:New-ManagementRoleAssignment -Role "Mailbox Import Export" -User "<user name or alias>"
Exporting a single mailbox:New-MailboxExportRequest -Mailbox <user> -FilePath \\<server FQDN>\<shared folder name>\<PST name>.pst
Exporting mailbox items older than a month that contain a keyword in the subject:New-MailboxExportRequest -Mailbox <user> -ContentFilter {Received -lt (get-date).adddays(-30)} -and (Subject -like 'fwd*')} -FilePath \\<server FQDN>\<shared folder name>\<PST name>.pst
Exporting all items except junk & deleted items:New-MailboxExportRequest -ExcludeFolders "#JunkEmail#","#DeletedItems#" -Mailbox <user> -FilePath \\<server FQDN>\<shared folder name>\<PST name>.pst
Export archive only:New-MailboxExportRequest -Mailbox <user> -IsArchive -FilePath \\<server FQDN>\<shared folder name>\<PST name>.pst
Export all mailboxes to a specific shared folder:$AllMailboxes = Get-Mailbox;
$AllMailboxes = $AllMailboxes.SamAccountName;
foreach ($Mailbox in $AllMailboxes) { New-MailboxExportRequest -name "export $Mailbox" -Mailbox $Mailbox -FilePath "\\<server FQDN>\<shared folder name>\$($Mailbox).pst"}
To return your server’s FQDN and use it to export all mailboxes:$myFQDN=(Get-WmiObject win32_computersystem).DNSHostName+"."+(Get-WmiObject win32_computersystem).Domain
foreach ($Mailbox in $AllMailboxes) { New-MailboxExportRequest -name "export-$Mailbox" -Mailbox $Mailbox -FilePath "\\$myFQDN\share\$($Mailbox.Alias).pst"}
Usefull links: