Migrate · 1 tool
Validate target MailUsers before a cross-tenant batch
Summary
Compares the source mailbox export with the target MailUsers and flags every user who would fail: missing object, ExchangeGuid or ArchiveGuid mismatch, missing x500, or a mailbox that already exists.
Implementation
Choose your tool. Your choice is remembered on other samples.
Connect-ExchangeOnline -ShowBanner:$false
Import-Csv .\source-export.csv | ForEach-Object {
$upn = $_.UserPrincipalName -replace "@source.com", "@target.com"
$m = Get-MailUser -Identity $upn -ErrorAction SilentlyContinue
[pscustomobject]@{
User = $upn
Exists = [bool]$m
ExchangeGuid = $m.ExchangeGuid -eq $_.ExchangeGuid
ArchiveGuid = (-not $_.ArchiveGuid -or $_.ArchiveGuid -eq "00000000-0000-0000-0000-000000000000") -or ($m.ArchiveGuid -eq $_.ArchiveGuid)
LegacyDNx500 = [bool]($m.EmailAddresses -contains "x500:$($_.LegacyExchangeDN)")
NoMailbox = -not (Get-Mailbox -Identity $upn -ErrorAction SilentlyContinue)
}
} | Export-Csv .\mailuser-validation.csv -NoTypeInformationPrerequisites
- Exchange Administrator in the target tenant
- Source export CSV with UserPrincipalName, ExchangeGuid, ArchiveGuid, LegacyExchangeDN
Output
Validation CSV with one True/False column per check.
Related answers
Contributors
| Author | Role |
|---|---|
| Priyanshu Upadhyay | Solution Architect, Microsoft 365 and Azure |
InnovaticT