Can’t restore deleted mailbox even license assigned to the User in office 365

Issue: User has left the organization and re-joined after 2yr.

I have assigned the E3 license to the user mailbox after which mailbox should be restore as Mailbox was in Inactive with Litigation/Org. hold on it.

Now it’s giving me an error stating enable-mailbox failed with an unknown error. Below is the screenshot:

Environment:

  • Hybrid where all mailbox in Office 365, but identity is synced from on-prem AD.
  • Cloud only

Cause:

  • Mailbox was already present as Inactive
  • Identity is synced from on-prem and have different exchange GUID value on on-prem

Now we have 2 solutions based on choice.

New Mailbox

1: If we want new mailbox (we can delete the old mailbox from cloud)

Remove-mailbox -identity “ExchangeGUID” –IgnoreLegalHold -PermanentlyDelete $true

2: If we want new mailbox and want to keep the old one for compliance reason

(Set the msExchMailboxGuid =NULL of affected account on on-prem)

Run Delta sync which will sync the changes to O365.

If you want the old mailbox data to restored:

1: Looked for the mailbox if it’s in softdeleted :

2: Looked for the ExternalDircetoryObjectID value and found NULL.

Get-Mailbox -SoftDeletedMailbox -Identity Carl.Price |select ExternalDirectoryObjectId

ExternalDirectoryObjectId : NULL

When this attribute value is null, this mean mailbox can’t be restored automatically after assigning the license. Because its inactive mailbox.

Difference between Inactive and Soft deleted Mailbox:

If mailbox have ExternalDirectoryObjectId : GUID value than it will be restore as soon as user license assigned to the user account.

If mailbox does not have ExternalDirectoryObjectId : NULL then mailbox won’t be restore automatically.

Now as per the scenario 2 things can be done to achieve it :

1: Run below PS to restore mailbox content from inactive to New Active mailbox created. This process is time consuming process. It restores the data but inactive mailbox will be there in Inactive after restore.

New-mailboxrestorerequest -sourcemailbox “inactive mailbox exchange Guid Value” -TargetMailbox “New mailbox exchange GUID” -AllowlegacyDNmismatch

Note: This will not create separate hierarchy in usermailbox. It will restore the content to the same hierarchy as it was.

Ref.: Restore an inactive mailbox – Microsoft 365 Compliance | Microsoft Docs

2: Another solution, which is very easy and quick solution. Below ps will create a new user account with the inactive Mailbox where the SMTP address is new.

New-Mailbox -InactiveMailbox inactivemailbox@domain.com -Name “Test” -FirstName “A” -LastName “Test” -DisplayName “A TEST” -MicrosoftOnlineServicesID Newmailbox@domain.com -Password (ConvertTo-SecureString -String ‘P@ssw0rd’ -AsPlainText -Force) -ResetPasswordOnNextLogon $true

Note: This mailbox can be Hard Match with the on-prem identity. Which will override the on-prem attribute value to the mailbox after delta sync.

If you have cloud only environment, then Hard remove the old identity and edit New identity created as per requirements.

Leave Comment

Your email address will not be published.