Deleted mailbox recovery for license assigned user in Office 365

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 restored as Mailbox was in Inactive with Litigation/Org. hold on to it.

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


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


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

Now we have 2 solutions based on choice.

New Mailbox

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

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

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

(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 be 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 means mailbox can’t be restored automatically after assigning the license. Because it’s an inactive mailbox.

Difference between Inactive and Soft deleted Mailbox:

If mailbox has ExternalDirectoryObjectId : GUID value then it will be restored as soon as user license assigned to the user account.

If mailbox does not have ExternalDirectoryObjectId : NULL then mailbox won’t be restored 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 the 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 a separate hierarchy in user mailbox. 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 a 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 -Name “Test” -FirstName “A” -LastName “Test” -DisplayName “A TEST” -MicrosoftOnlineServicesID -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 a Comment