We’ve had a client where a single mailbox keeps failing, no matter what we do.
I was tired of having to restart this migration manually, so I whipped up a tiny script that would do it for me.
$username = "exchange365admin@tenant.onmicrosoft.com"
$password = ConvertTo-SecureString 'password' -AsPlainText -Force
$credential = New-Object System.Management.Automation.PSCredential ($username, $password)
Connect-ExchangeOnline -credential $credential
$migrationusers = Get-MigrationUser -ResultSize Unlimited | Where-Object {$_.Status -eq "Failed"}
$migrationusers | Start-MigrationUser
Disconnect-ExchangeOnline -Confirm:$false
I set up a scheduled task to run it regularly (every 15 minutes in my case) and a few days later, the mailbox was up and running in Microsoft 365.