Ever have one of those really odd problems that even Google couldn’t solve? Last week, I spent a few hours reliving this xkcd comic:
I didn’t have it quite as bad as the guy in the comic. I had a nice detailed error and a partial solution from here. With a bit of tinkering and PowerShell, I now have a full solution to failed mailbox migrations from Exchange 2010 (or 2013) to Office 365.
Error Message:
Warning: The mailbox was already moved but failed to update the job state during the final stages of the move. It is possible that the source mailbox could still be alive since post move cleanup operations were deliberately not executed.
Symptoms:
- Migrated mailbox still appears in on premise exchange management console.
- User can’t receive external emails in OWA.
- User can’t receive internal emails in Microsoft Office Outlook.
Solution:
- Backup exchange attributes from on premise AD account.
- Disconnect the mailbox from on premise exchange environment
- Repopulate exchange attributes
- Set missing exchange attributes (most likely – only targetaddress attribute needs to be set. Compare to other successfully migrated users to double check).
- Wait for sync to Office 365 or force sync by running the following PowerShell line:
Start-ADSyncSyncCycle -PolicyType Delta
You can use PowerShell to automate all of this. Below is a sample script that I put together:
add-pssnapin Microsoft.Exchange.Management.PowerShell.E2010 Import-Module ActiveDirectory $Username = "SadUsernameHere" $O365DomainName = "@OFFICE365DOMAINNAME.COM" $ADUser = Get-ADUser $Username -Properties * $Backup = Get-ADUser $Username -Properties * $TargetAddress = 'SMTP:' + $Username + $O365DomainName $Proxyaddresses = $ADUser | select -ExpandProperty proxyaddresses $mailNickname = $ADUser | select -ExpandProperty mailnickname $mail = $ADUser | select -ExpandProperty mail write-host $TargetAddress write-host $Proxyaddresses Write-Host $mailNickname Write-Host $mail pause Disable-Mailbox -Identity $username sleep -Seconds 5 Set-ADUser $Username -EmailAddress $mail -Replace @{mailNickname="$mailNickname";TargetAddress="$TargetAddress"} foreach ($Proxyaddress in $Proxyaddresses){ Write-Host $Proxyaddress Set-ADUser $Username -Add @{Proxyaddresses="$Proxyaddress"} }
The script above uses the Exchange 2010 PowerShell cmdlets. You will need to customize the $username variable and the $O365DomainName variable.