Difference between revisions of "Exchange Server Mailbox Migration"
From DFWLPiki
(One intermediate revision by the same user not shown) | |||
Line 21: | Line 21: | ||
Same thing, but Exchange 2016 (or probably newer) | Same thing, but Exchange 2016 (or probably newer) | ||
New-ManagementRoleAssignment –Role “Mailbox Import Export” –User [DOMAIN\username] | New-ManagementRoleAssignment –Role “Mailbox Import Export” –User [DOMAIN\username] | ||
+ | New-MailboxExportRequest -Mailbox ALIAS -FilePath \\UNCPath\PSTs\ALIAS.pst | ||
foreach ($i in (get-mailbox)) { New-MailboxExportRequest -Mailbox $i.Alias -FilePath \\UNCPath\PSTs\$($i.Alias).pst } | foreach ($i in (get-mailbox)) { New-MailboxExportRequest -Mailbox $i.Alias -FilePath \\UNCPath\PSTs\$($i.Alias).pst } | ||
+ | foreach ($i in (get-mailbox)) { New-MailboxExportRequest -Mailbox $i.Alias -IsArchive -FilePath \\UNCPath\PSTs\$($i.Alias).pst } | ||
Get-MailboxExportRequest -Status Completed | Remove-MailboxExportRequest | Get-MailboxExportRequest -Status Completed | Remove-MailboxExportRequest | ||
Latest revision as of 20:49, 19 May 2022
Exporting and Importing Mailboxes for Offline Exchange Server Migration
Exporting from Exchange 2007:
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
Same thing, but Exchange 2016 (or probably newer)
New-ManagementRoleAssignment –Role “Mailbox Import Export” –User [DOMAIN\username] New-MailboxExportRequest -Mailbox ALIAS -FilePath \\UNCPath\PSTs\ALIAS.pst foreach ($i in (get-mailbox)) { New-MailboxExportRequest -Mailbox $i.Alias -FilePath \\UNCPath\PSTs\$($i.Alias).pst } foreach ($i in (get-mailbox)) { New-MailboxExportRequest -Mailbox $i.Alias -IsArchive -FilePath \\UNCPath\PSTs\$($i.Alias).pst } Get-MailboxExportRequest -Status Completed | Remove-MailboxExportRequest
Importing all .Pst files in Exchange 2013 or 2016
(don't forget to ensure New-ManagementRoleAssignment has been set if you're working with a different server AND restart Exchange powershell)
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, Auditlog, and DiscoverySearch:
Get-Mailbox -Arbitration | New-Moverequest -Targetdatabase "Database Name" Get-Mailbox DiscoverySearchMailbox* | New-MoveRequest -TargetDatabase "Database Name" Get-Mailbox -Database DLP-PROD01 -AuditLog | 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 Get-MoveRequestStatistics -Identity username | fl Get-MoveRequestStatistics -Identity username | fl totalmailboxitemcount,bytestransferred,itemstransferred,PercentComplete
Remove completed migration jobs:
Get-MoveRequest -MoveStatus completed | Remove-MoveRequest