When you copy mailboxes to Microsoft 365, specific retention or hold settings can cause the Recoverable Items folder to fill up at the destination.
The most common settings that lead to this are:
Litigation Hold
Single Item Recovery
Delay holds (applied automatically when retention or hold settings change)
These are often enabled by default on new Exchange Online mailboxes.
ShareGate Migrate detects these potential problems and lists the affected mailboxes in a report that you can find on the Copy Summary screen, which is displayed before you launch your mailbox migration.
How to identify problematic holds and turn them off
You can identify and turn off problematic holds on mailboxes before launching your mailbox migration and re-enable them afterward using the following PowerShell scripts.
When you set up a migration with Copy mailboxes or Copy from Gmail, you will get a warning notification in the Copy summary screen if any of your mailboxes have holds on them.
When you see the warning message, click Export list of on-hold mailboxes to save the list to your drive. Then, update the script below with the path to your exported CSV file and run it for your destination environment.
Once the script finishes running, wait at least 4 hours for the settings to take effect in Exchange Online before proceeding with your migration.
Note: Disabling a Litigation Hold will remove copies of modified items stored in the Versions folder. This usually isn’t an issue since destination mailboxes are typically new and empty.
Disable holds
$CsvPath = Read-Host "Replace this message with the absolute path of the report you saved on your drive between these quotation marks"
$CsvPath = $CsvPath.Trim('"')
if (-not $CsvPath) {
Write-Error "No path provided. Exiting."
return
}
if (-not (Test-Path -LiteralPath $CsvPath)) {
Write-Error "File not found at '$CsvPath'. Exiting."
return
}
$ErrorActionPreference = 'Stop'
$ModuleName = "ExchangeOnlineManagement"
$RequiredVersion = "3.9.0"
$module = Get-Module -ListAvailable -Name $ModuleName | Where-Object {
$_.Version -eq [Version]$RequiredVersion
}
if (-not $module) {
Install-Module -Name $ModuleName -RequiredVersion $RequiredVersion `
-Scope CurrentUser -Force -AllowClobber
}
Import-Module -Name $ModuleName -RequiredVersion $RequiredVersion -Force
Connect-ExchangeOnline -ShowBanner:$false
try {
$rows = Import-Csv -LiteralPath $CsvPath
foreach ($r in $rows) {
$email = $r.EmailAddress
if ($r.LitigationHoldEnabled -ieq 'true') {
Set-Mailbox -Identity $email -LitigationHoldEnabled $false
Write-Host "Disabled LitigationHold: $email"
}
if ($r.SingleItemRecoveryEnabled -ieq 'true') {
Set-Mailbox -Identity $email -SingleItemRecoveryEnabled $false
Write-Host "Disabled SingleItemRecovery: $email"
}
if ($r.DelayHoldApplied -ieq 'true') {
Set-Mailbox -Identity $email -RemoveDelayHoldApplied $true
Write-Host "Removed DelayHoldApplied: $email"
}
}
}
finally {
Disconnect-ExchangeOnline -Confirm:$false
}
Restore Holds
You can update the script below with the path to your exported CSV file and run it to enable the holds back on your destination.
$CsvPath = Read-Host "Replace this message with the absolute path of the report you saved on your drive between these quotation marks"
$CsvPath = $CsvPath.Trim('"')
if (-not $CsvPath) {
Write-Error "No path provided. Exiting."
return
}
if (-not (Test-Path -LiteralPath $CsvPath)) {
Write-Error "File not found at '$CsvPath'. Exiting."
return
}
$ErrorActionPreference = 'Stop'
$ModuleName = "ExchangeOnlineManagement"
$RequiredVersion = "3.9.0"
$module = Get-Module -ListAvailable -Name $ModuleName | Where-Object {
$_.Version -eq [Version]$RequiredVersion
}
if (-not $module) {
Install-Module -Name $ModuleName -RequiredVersion $RequiredVersion `
-Scope CurrentUser -Force -AllowClobber
}
Import-Module -Name $ModuleName -RequiredVersion $RequiredVersion -Force
Connect-ExchangeOnline -ShowBanner:$false
try {
$rows = Import-Csv -LiteralPath $CsvPath
foreach ($r in $rows) {
$email = $r.EmailAddress
if ($r.LitigationHoldEnabled -ieq 'true') {
Set-Mailbox -Identity $email -LitigationHoldEnabled $true
Write-Host "Enabled LitigationHold: $email"
}
if ($r.SingleItemRecoveryEnabled -ieq 'true') {
Set-Mailbox -Identity $email -SingleItemRecoveryEnabled $true
Write-Host "Enabled SingleItemRecovery: $email"
}
}
}
finally {
Disconnect-ExchangeOnline -Confirm:$false
}
