Exchange Server Mailbox Migration
From DFWLPiki
Exporting and Importing Mailboxes for Offline Exchange Server Migration
These are commands I am saving for later use on an upcoming migration project:
Get-Mailbox | Add-MailboxPermission –user [adminusername] –AccessRight FullAccess –Inheritancetype all Get-Mailbox -Database “[SERVERNAME]\First Storage Group\Mailbox Database” | Export-Mailbox -PSTFolderPath c:\PSTs Get-Mailbox -Database “[SERVERNAME]\First Storage Group\Mailbox Database” | Import-Mailbox -PSTFolderPath c:\PSTs Get-Mailbox | Remove-MailboxPermission –user [adminusername] –AccessRight FullAccess –Inheritancetype all
Single run:
Import-Mailbox -Identity <mailboxUser> -PSTFolderPath D:\PSTs Export-Mailbox -Identity <mailboxUser> -PSTFolderPath D:\PSTs
Now same thing, but Exchange 2010
New-ManagementRoleAssignment –Role “Mailbox Import Export” –User [DOMAIN\username] foreach ($i in (Get-Mailbox)) { New-MailboxExportRequest -Mailbox $i -FilePath "\\UNCPath\PSTs\$($i.Alias).pst" } Get-MailboxExportRequest -Status Completed | Remove-MailboxExportRequest
Importing all .Pst files in Exchange 2013
(don't forget to ensure New-ManagementRoleAssignment has been set if you're working with a different server)
Dir \\HOSTNAME\e$\PSTs\*.pst | %{ New-MailboxImportRequest -Name RecoveredPST -BatchName Recovered -BadItemLimit 1000000 -AcceptLargeDataLoss -Mailbox $_.BaseName -FilePath $_.FullName} Get-MailboxImportRequest -Status Completed | Remove-MailboxImportRequest
Same thing, but single maildatabase:
New-MailboxImportRequest -Mailbox [Username] -IsArchive -FilePath \\UNCPath\PSTs\filename.pst
Mailbox Migrations
Move Mailbox from one database to another: Test it to see if a sigle mailbox is ready to move:
New-MoveRequest -identity jhorne -TargetDatabase "DFWLP DEV Mailboxes" -WhatIf
Then move it:
New-MoveRequest -identity jhorne -TargetDatabase "DFWLP DEV Mailboxes"
Move all Mailboxes:
foreach ($i in (Get-Mailbox)) { New-MoveRequest -Identity $i -TargetDatabase "DLP Prod Mailboxes" }
Move Arbitration Mailboxes:
Get-Mailbox -Arbitration | New-Moverequest -Targetdatabase "Database Name"
List all mailboxes:
Get-mailbox
List all mailboxes and show current database:
Get-Mailbox | fl alias,database
List current migration jobs:
Get-MoveRequest
Remove completed migration jobs:
Get-MoveRequest -MoveStatus completed | Remove-MoveRequest