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):

{code lang:xml title:”Show Mailbox ExternalAccount Permission” lines:true hidden:false}$mbx = Get-Mailbox “alias”
$mbx | Get-MailboxPermission | ? {$_.accessrights -like “*ExternalAccount*”} {/code}

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!

{code lang:css title:”Cleanup Script” lines:true hidden:false}# Identify all LINKED mailboxes
$linkedmbx = Get-Mailbox | ? {$_.islinked -eq $true}

foreach ($mbx in $linkedmbx)
{

# Find and Remove Associated External Account Permission
$extacc = $mbx | Get-MailboxPermission | ? {$_.accessrights -like “*ExternalAccount*”}
$extacc.User
Remove-MailboxPermission -Identity $mbx.DistinguishedName -User $extacc.User -AccessRights ExternalAccount

# Change the Mailbox Type and Null the msExchMasterAccountSid attribute for the user
$LDAPPath = “LDAP://” + $mbx.DistinguishedName
$LDAPPath | fl

$user = [ADSI]”$LDAPPath”
$user | fl

$user.put(“msExchRecipientTypeDetails”,1)
$user.putex(1,”msExchMasterAccountSid”,$null)
$user.setinfo(){/code}