-->

Sunday, April 8, 2018

Exchange - Reconnecting An Orphaned Linked Mailbox

Here's a "fun" scenario: Exchange is installed in a Resource Forest. A user's AD account in the Accounts Forest was deleted by our SAP automated system (I dunno why does it has so much control), which orphaned the Linked Mailbox because now there's no master account to attach to.

The mailbox isn't listed in the EAC:

EAC Missing Mailbox

And the recipient can't be found:

Get-Recipient sarah.one@exchangeitup.com

The operation couldn't be performed because object 'sarah.one@exchangeitup.com' couldn't be found on 'DC1.exchangeitup.com'.

Running the Get-MailboxStatistics cmdlet, shows that it does exist...but floating around in the ether maybe?

You can see that the mailbox isn't disconnected, but it's also not attached to an account:

Get-MailboxDatabase | Get-MailboxStatistics | Where { $_.DisplayName -eq "sarah one" } | fl DisplayName,Database,DisconnectReason

DisplayName               : Sarah One
Database                       : DB01
DisconnectReason        :

Reconnecting the Mailbox:

Resurrect the Account:

First, we'll need to de-tombstone the AD account in the Accounts forest, then do the same in the Resource Forest.

**Note** You'll need to have the AD Recycle Bin enabled...hopefully you already do. Otherwise, you'll need to create a new account for the user...that's painful.

Connect the Linked Mailbox:

Next, we'll connect the orphaned mailbox to the restored/new AD account. Fire up the EMS (Exchange Management Shell) and run the following:

$cred - Get-Credential

**Note** Passing creds is only required depending on your Trust setup. Once you run the above cmdlet you will input your Accounts Forest admin credentials.

Next, run:

Get-MailboxDatabase DB01 | Get-MailboxStatistics | where ($_.displayname -eq "Sarah One" } | Connect-Mailbox -Alias "SarahOne" -LinkedMasterAccount "exchitup.com\SarahOne" -LinkedDomainController "DC.exchitup.com" -Database DB01 -LinkedCredential $cred

**Note** Change "DB01", displayname, -Alias, -LinkedMasterAccount, -LinkedDomainController, and -Database to match your environment

And, done!

Check the EAC and you'll see the mailbox is alive.

Connecting a User Mailbox:

UserMailboxes don't tend to be "orphaned" very often when a user account is deleted, they just get disconnected.

But just to cover our bases, in case it does happen, the following cmdlet will get it back working.

After you restore the deleted AD account, run the following cmdlet:

Get-MailboxDatabase -Identity "D01"  | Get-MailboxStatistics | Where { $_.Displayname -eq "Sarah One" } | Connect-Mailbox -User "sarahone"

**Note** Again, change "D01", displayname, and -User

Your user should be happy...now fix whatever deleted your accounts!

No comments:

Post a Comment