Converting a mailbox type in Active Directory

After converting a Regular Mailbox or a Shared mailbox in Exchange Online.
The AD object isn't updated back to on premise (Exchange 2010)

To convert AD object to correct mailbox type:

  
# Convert to Remote Shared Mailbox 
# Use Powershell with the Active Directory Module
$SamAccountname = 'Username'
Disable-AdAccount $SamAccountname  
Set-AdUser $SamAccountname -Replace @{msExchRemoteRecipientType="100"}  
Set-AdUser $SamAccountname -Replace @{msExchRecipientTypeDetails="34359738368"}  
  
# Convert to Remote Regular Mailbox 
# Use Powershell with the Active Directory Module
$SamAccountname = 'Username'
Enable-AdAccount $SamAccountname  
Set-AdUser $SamAccountname -Replace @{msExchRemoteRecipientType="4"}  
Set-AdUser $SamAccountname -Replace @{msExchRecipientTypeDetails="2147483648"}