Skip to main content

Identify non-migratable mailbox folders with PowerShell

Use a PowerShell script to find mailbox folder types that ShareGate Migrate cannot detect or migrate.

Note: PowerShell integration requires a ShareGate Migrate Pro or Enterprise subscription. It is not available on the Essentials plan.

The script identifies two types of mailbox folders that ShareGate Migrate will not copy:

  • Not detected — folders with non-standard container classes (such as IPF.Imap or IPF.SkypeTeams.Message) that ShareGate Migrate cannot see. These folders do not appear in your migration report.

  • Skipped by design — well-known system folders that ShareGate Migrate detects but does not copy: ConversationHistory, Clutter, SyncIssues, Conflicts, LocalFailures, ServerFailures, RecoverableItemsDeletions, and SearchFolders. These are also not flagged in the migration report.

Run Get-NonMigratableMailboxFolders.ps1 before or after a migration to identify both types and assess any gaps in coverage.

Prerequisites

  • Windows PowerShell (using the command prompt is recommended for best results)

  • Access to the source mailbox with Exchange Online permissions

Run the script

Copy the script below and save it as Get-NonMigratableMailboxFolders.ps1, then run it from the command prompt.

param(
# Change this to the mailbox you want to scan
[Parameter(Mandatory = $true)]
[string]$Mailbox,

# Optional: provide a file path to also export the results as a CSV
[Parameter(Mandatory = $false)]
[string]$CsvOutputPath
)

$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
}

Import-Module -Name $ModuleName -RequiredVersion $RequiredVersion -Force

Connect-ExchangeOnline -ShowBanner:$false

try {
Write-Host "Scanning mailbox: $Mailbox" -ForegroundColor Cyan

$folders = Get-MailboxFolderStatistics -Identity $Mailbox |
Select-Object Name, FolderPath, FolderType, ContainerClass

$nonDetectable = @($folders | Where-Object {
$class = $_.ContainerClass
-not (
[string]::IsNullOrEmpty($class) -or
$class -eq 'IPF.Note' -or $class -like 'IPF.Note.*' -or
$class -eq 'IPF.Appointment' -or $class -like 'IPF.Appointment.*' -or
$class -eq 'IPF.Contact' -or $class -like 'IPF.Contact.*' -or
$class -eq 'IPF.Task' -or $class -like 'IPF.Task.*'
)
})

$skippedFolderTypes = @(
'ConversationHistory',
'Clutter',
'SyncIssues',
'Conflicts',
'LocalFailures',
'ServerFailures',
'RecoverableItemsDeletions',
'SearchFolders'
)
$skippedByDesign = @($folders | Where-Object { $skippedFolderTypes -contains $_.FolderType })

if ($nonDetectable.Count -eq 0) {
Write-Host "No non-detectable folders found." -ForegroundColor Green
}
else {
Write-Host "`nFolders that will NOT be detected by ShareGate ($($nonDetectable.Count) found):" -ForegroundColor Yellow
$nonDetectable | Format-Table Name, FolderPath, FolderType, ContainerClass -AutoSize
}

if ($skippedByDesign.Count -eq 0) {
Write-Host "No folders skipped by design found." -ForegroundColor Green
}
else {
Write-Host "`nFolders that ShareGate detects but skips by design ($($skippedByDesign.Count) found):" -ForegroundColor Yellow
$skippedByDesign | Format-Table Name, FolderPath, FolderType, ContainerClass -AutoSize
}

if ($CsvOutputPath) {
$report = @()
$report += $nonDetectable | Select-Object @{ Name = 'Reason'; Expression = { 'NotDetected' } }, Name, FolderPath, FolderType, ContainerClass
$report += $skippedByDesign | Select-Object @{ Name = 'Reason'; Expression = { 'SkippedByDesign' } }, Name, FolderPath, FolderType, ContainerClass
$report | Export-Csv -LiteralPath $CsvOutputPath -NoTypeInformation -Encoding UTF8
Write-Host "Report exported to: $CsvOutputPath" -ForegroundColor Green
}
}
finally {
Disconnect-ExchangeOnline -Confirm:$false
}

To print results to the console:

.\Get-NonMigratableMailboxFolders.ps1 -Mailbox "[email protected]"

To export results to a CSV file:

.\Get-NonMigratableMailboxFolders.ps1 -Mailbox "[email protected]" -CsvOutputPath "C:\Reports\non-migratable-folders.csv"

The exported file includes a Reason column with the value NotDetected or SkippedByDesign for each folder.

Troubleshooting

Module install error

If you see an error when the script tries to install the ExchangeOnlineManagement module, open the script in a text editor and add -AllowClobber to the Install-Module line:

Install-Module -Name $ModuleName -RequiredVersion $RequiredVersion -Scope CurrentUser -Force -AllowClobber
Did this answer your question?