====== Export/Import users mailbox into PST file using PowerShell ======
Grant admin user the privilege to import/expoer mailboxes
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-mailboxstatistics username | format-table displayname,TotalItem*
Export mailbox to PST, and see the export status
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
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
foreach ($Mailbox in (Get-Mailbox)) { New-MailboxExportRequest -Mailbox $Mailbox -FilePath "\\\\$($Mailbox.Alias).pst" }
Suspend and resume export request
Suspend-MailboxExportRequest -Identity "Ayla\MailboxExport"
Resume-MailboxExportRequest -Identity kweku\export