Export/Import users mailbox into PST file using PowerShell
Grant admin user the privilege to import/expoer mailboxes
- Add role
New-ManagementRoleAssignment -Role "Mailbox Import Export" -User Administrator
Create a network share with Exchange Trusted Subsystem group r/w permissions
Check the mailbox size:
- Get mailbox size
get-mailboxstatistics username | format-table displayname,TotalItem*
Export mailbox to PST, and see the export status
- Export mailbox to PST
New-MailboxExportRequest -Mailbox username -FilePath \\server\share\file.pst Get-MailboxExportRequest Get-MailboxExportRequest -Name MailboxExport | fl Get-MailboxExportRequest | Get-MailboxExportRequestStatistics Get-MailboxExportRequest | where {$_.status -eq "Completed"} Get-MailboxExportRequest | where {$_.status -eq "Completed"} | Remove-MailboxExportRequest
Import PST into the new mailbox - first line imports into root, the second line creates a folder and imports into that folder
- Import PST into mailbox
New-MailboxImportRequest -FilePath \\server\share\file.pst -Mailbox uname New-MailboxImportRequest -FilePath \\server\share\file.pst -Mailbox uname -TargetRootFolder "Old data" Get-MailboxImportRequest Get-MailboxImportRequest | Get-MailboxImportRequestStatistics Get-MailboxImportRequest | where {$_.status -eq "Completed"} | Remove-MailboxImportRequest
Export all mailboxes
- export all mailboxes
foreach ($Mailbox in (Get-Mailbox)) { New-MailboxExportRequest -Mailbox $Mailbox -FilePath "\\<server FQDN>\<shared folder name>\$($Mailbox.Alias).pst" }
Suspend and resume export request
Suspend-MailboxExportRequest -Identity "Ayla\MailboxExport" Resume-MailboxExportRequest -Identity kweku\export