Exchange 2007 : Convert Linked Mailbox to User Mailbox

Exchange 2007 and 2010 : Convert Linked Mailbox to User Mailbox

During a migration cleanup I came across several user mailboxes that were 'Linked' and not 'User' mailboxes.

(In a non resource forest model) this is usually caused by;

  1. Associated External Account Permission
  2. Attribute 'msExchMasterAccountSid' is not nullĀ  / 'msExchRecipientTypeDetails' set to '2' (both are usually as a result of 1)

Associated External Account Permission

Executing the following command did reveal that there was a permission for an External Account (despite the account being in the same domain as the mailbox):

Show Mailbox ExternalAccount Permission

View source
  1. $mbx = Get-Mailbox "alias"
  2. $mbx | Get-MailboxPermission | ? {$_.accessrights -like "*ExternalAccount*"}

Attribute 'msExchMasterAccountSid' is not nullĀ  / 'msExchRecipientTypeDetails' set to '2'

Using adsiedit I confirmed that the 'msExchRecipientTypeDetails' attribute was set to 2 (Linked) and not 1 (User), and that the 'msExchMasterAccountSid' attribute was not null (not default!).

Correcting the Issue

Executing the following script in the Exchange Management Shell will change ALL mailboxes from Linked to user, modify the mailbox alias as required. Be sure this is what you want to do! In a Resource Forest scenario this would be undesirable to say the least!

Cleanup Script

View source
  1. # Identify all LINKED mailboxes
  2. $linkedmbx = Get-Mailbox | ? {$_.islinked -eq $true}
  3.  
  4. foreach ($mbx in $linkedmbx)
  5. {
  6.  
  7. # Find and Remove Associated External Account Permission
  8. $extacc = $mbx | Get-MailboxPermission | ? {$_.accessrights -like "*ExternalAccount*"}
  9. $extacc.User
  10. Remove-MailboxPermission -Identity $mbx.DistinguishedName -User $extacc.User -AccessRights ExternalAccount
  11.  
  12. # Change the Mailbox Type and Null the msExchMasterAccountSid attribute for the user
  13. $LDAPPath = "LDAP://" + $mbx.DistinguishedName
  14. $LDAPPath | fl
  15.  
  16. $user = [ADSI]"$LDAPPath"
  17. $user | fl
  18.  
  19. $user.put("msExchRecipientTypeDetails",1)
  20. $user.putex(1,"msExchMasterAccountSid",$null)
  21. $user.setinfo()