Difference between revisions of "Exchange Server Mailbox Migration"

From DFWLPiki
Jump to: navigation, search
(Created page with "Category:Exchange ==Exporting and Importing Mailboxes for Offline Exchange Server Migration== These are commands I am saving for later use on an upcoming migration projec...")
 
 
(8 intermediate revisions by the same user not shown)
Line 2: Line 2:
 
==Exporting and Importing Mailboxes for Offline Exchange Server Migration==
 
==Exporting and Importing Mailboxes for Offline Exchange Server Migration==
  
These are commands I am saving for later use on an upcoming migration project:
+
Exporting from Exchange 2007:
  
 
  Get-Mailbox | Add-MailboxPermission –user [adminusername] –AccessRight FullAccess –Inheritancetype all
 
  Get-Mailbox | Add-MailboxPermission –user [adminusername] –AccessRight FullAccess –Inheritancetype all
Line 19: Line 19:
 
  Get-MailboxExportRequest -Status Completed | Remove-MailboxExportRequest
 
  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
+
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)
+
(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}
 
   Dir \\HOSTNAME\e$\PSTs\*.pst | %{ New-MailboxImportRequest -Name RecoveredPST -BatchName Recovered -BadItemLimit 1000000 -AcceptLargeDataLoss -Mailbox $_.BaseName -FilePath $_.FullName}
 
  Get-MailboxImportRequest -Status Completed | Remove-MailboxImportRequest
 
  Get-MailboxImportRequest -Status Completed | Remove-MailboxImportRequest
Line 37: Line 43:
 
Move all Mailboxes:  
 
Move all Mailboxes:  
 
  foreach ($i in (Get-Mailbox)) { New-MoveRequest -Identity $i -TargetDatabase "DLP Prod Mailboxes" }
 
  foreach ($i in (Get-Mailbox)) { New-MoveRequest -Identity $i -TargetDatabase "DLP Prod Mailboxes" }
Move Arbitration Mailboxes:
+
Move Arbitration, Auditlog, and DiscoverySearch:
 
  Get-Mailbox -Arbitration | New-Moverequest -Targetdatabase "Database Name"
 
  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:
 
List all mailboxes:
 
  Get-mailbox
 
  Get-mailbox
Line 45: Line 53:
 
List current migration jobs:
 
List current migration jobs:
 
  Get-MoveRequest
 
  Get-MoveRequest
 +
Get-MoveRequestStatistics -Identity username | fl
 +
Get-MoveRequestStatistics -Identity username | fl totalmailboxitemcount,bytestransferred,itemstransferred,PercentComplete
 
Remove completed migration jobs:
 
Remove completed migration jobs:
 
  Get-MoveRequest -MoveStatus completed | Remove-MoveRequest
 
  Get-MoveRequest -MoveStatus completed | Remove-MoveRequest

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