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.

Exchange Online PowerShell
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 -NoTypeInformation

Prerequisites

  • 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

AuthorRole
Priyanshu UpadhyaySolution Architect, Microsoft 365 and Azure
Disclaimer. These samples are provided as is, without warranty of any kind. Read and test every script in a non-production tenant before you run it, and run reports before any command that changes or deletes data.