Exchange Online migration – Unable to update Active Directory information for the source mailbox at the end of the move.

Hi guys,

During an Exchange On-Premises migration to Exchange Online you may encounter an error sayig:

Error: MigrationMRSPermanentException: Warning: Unable to update Active Directory information for the source mailbox at the end of the move. Error details: An error occurred while updating a user object after the move operation. –> The type initializer for ???’Microsoft.Exchange.Configuration.Tasks.TaskLogger???’ threw an exception. –> Access is denied

You mainly face this error because of permissions issue with the account that is configured in the migration endpoint, therefor you may want to check the effective permissions of the migration endpoint account to the failing migration account.

If by any means you cannot correct the issue, I wrote this function to update the Active Directory account with the right informations:
[ps]Function Complete-RemoteMailboxConvertion {
<#
.SYNOPSIS
Function that will correct issue with the standard Exchange process to convert a mailbox to a remote mailbox.

.DESCRIPTION
The standard process of mailbox to remote mailbox convertion in a On-Premise Exchange to Exchange Online migration may fail for some reasons. This function will allow you to convert a mailbox to a remote mailbox.

.PARAMETER Identity
The identity used to find the user mailbox in Exchange Servers.

.EXAMPLE
Complete-RemoteMailboxConversion -Identity John.Doe
Will complete the convertion has a remote mailbox of John Doe’s mailbox.

.NOTES
Author: Thomas Prud’homme (@prudhommewtf).
Version: 1.0 (5/4/2017)
#>
#requires -module ActiveDirectory
[CmdletBinding(
SupportsShouldProcess = $true
)]
Param(
[Parameter(
Mandatory = $true,
ValueFromPipeline = $true
)]
[String]$Identity
)
Begin {
Write-Verbose -Message "Starting $($MyInvocation.InvocationName)"

Set-AdServerSettings -ViewEntireForest $True

#Gathering Mailbox information
try {
$MailboxInfos = Get-Mailbox -Identity $Identity
Write-Verbose -Message "Found $Identity mailbox information"
}
catch {Write-Error -Message $_}
}
Process {
#Finding the Office 365 Technical Email Address in proxyAddresses
foreach ($address in $MailboxInfos.EmailAddresses) {
try {
if ($address.SmtpAddress.IndexOf(‘.mail.onmicrosoft.com’) -gt 0) {
$routingEmailAddress = "SMTP:$($address.SmtpAddress)"
}
}
catch {}
}

#Setting the ADUser properties
try {
#Gathering AD account informaitons and old values that will be changed
$ADAccountInfos = Get-ADUser -Filter "UserPrincipalName -eq ‘$($MailboxInfos.UserPrincipalName)’" -Properties homeMDB, homeMTA, msExchHomeServerName, msExchVersion, msExchRecipientDisplayType, msExchRecipientTypeDetails, msExchRemoteRecipientType, targetAddress

#Backing up old values
$ADAccountInfos | Export-Clixml -Path "$pwd\OldValues_$($ADAccountInfos.SamAccountName).xml" -Force

#Setting changes
$ADAccountInfos | Set-ADUser -Clear homeMDB, homeMTA, msExchHomeServerName -Replace @{
msExchVersion = ‘44220983382016’
msExchRecipientDisplayType = ‘-2147483642’
msExchRecipientTypeDetails = ‘2147483648’
msExchRemoteRecipientType = ‘4’
targetAddress = $routingEmailAddress
}
}
catch {Write-Error -Message $_}
}
End {
Write-Verbose -Message "Ending $($MyInvocation.InvocationName)…"
}
}[/ps]