Manage inactive mailboxes

Completed

When an employee leaves or takes an extended leave from your organization, you can delete their Microsoft 365 account, and their mailbox data will still be available for 30 days after deletion. However, If you apply a Microsoft 365 retention policy, retention label, or a hold to the mailbox before deleting the account, it will become an inactive mailbox. Inactive mailboxes can be useful for retaining the mailbox content of former employees for regulatory or other purposes for longer periods of time.

Confirm a hold is applied to a mailbox

Whether you apply a retention policy, retention labels, eDiscovery hold, Litigation hold, or have an existing In-Place Hold, you can confirm the hold is successfully applied to the mailbox by using PowerShell. It's important to confirm a hold is in place prior to removing the license assigned as you can't assign a hold to an unlicensed mailbox.

You can run the following command to get information about the holds and Microsoft Purview retention policies applied to a mailbox:

Get-Mailbox <username> | FL LitigationHoldEnabled,InPlaceHolds

The following table describes how to identify different types of holds based on the values in the InPlaceHolds property when you run the Get-Mailbox cmdlet.

Hold type Example value How to identify the hold
Litigation Hold True Litigation Hold is enabled for a mailbox when the LitigationHoldEnabled property is set to True.
eDiscovery hold UniH7d895d48-7e23-4a8d-8346-533c3beac15d The InPlaceHolds property contains the GUID of any hold associated with an eDiscovery case in the compliance portal. You can tell this is an eDiscovery hold because the GUID starts with the UniH prefix (which denotes a Unified Hold).
In-Place Hold c0ba3ce811b6432a8751430937152491
or
cld9c0a984ca74b457fbe4504bf7d3e00de
The InPlaceHolds property contains the GUID of the In-Place Hold that's placed on the mailbox. You can tell this is an In-Place Hold because the GUID either doesn't start with a prefix or it starts with the cld prefix.
Microsoft Purview retention policy applied to the mailbox mbxcdbbb86ce60342489bff371876e7f224:1
or
skp127d7cf1076947929bf136b7a2a8c36f:3
The InPlaceHolds property contains GUIDs of any specific location retention policy that's applied to the mailbox. You can identify retention policies because the GUID starts with the mbx or the skp prefix. The skp prefix indicates that the retention policy is applied to Skype for Business conversations in the user's mailbox.
Excluded from an organization-wide Microsoft Purview retention policy -mbxe9b52bf7ab3b46a286308ecb29624696 If a mailbox is excluded from an organization-wide Microsoft Purview retention policy, the GUID for the retention policy that the mailbox is excluded from is displayed in the InPlaceHolds property and is identified by the -mbx prefix.

Create an inactive mailbox

Once the hold is in place on the mailbox, you can make the mailbox inactive by deleting the corresponding user account. It's recommended to use the Microsoft 365 admin center to delete users from your organization. However, you can also delete the mailbox by using the Remove-Mailbox cmdlet in Exchange Online PowerShell.

For example

Remove-Mailbox -identity "Walter harp" 

After the user account is deleted, any Exchange Online license associated with the user account will be available to assign to a new user.

For more information on deleting user accounts, see Delete a user from your organization.

Recover or restore an inactive mailbox

If an employee returns to your organization or if another employee takes on the job responsibilities of the former employee, there are two ways that you can make the contents of the inactive mailbox available to a user:

  • Recover an inactive mailbox. If the former employee returns to your organization, or if a new employee is hired to take on the job responsibilities of the former employee, you can recover the contents of the inactive mailbox. This method converts the inactive mailbox to a new, active mailbox that contains the contents of the inactive mailbox. After it's recovered, the inactive mailbox no longer exists. The procedures in this article describe this method.

  • Restore an inactive mailbox. If another employee takes on the job responsibilities of the former employee, or if another user needs access to the contents of the inactive mailbox, you can restore (or merge) the contents of the inactive mailbox to an existing mailbox. You can also restore the archive from an inactive mailbox.

To recover an inactive mailbox using Exchange Online PowerShell, complete the following steps:

  1. Run the following command to get identity information for the inactive mailboxes in your organization.

    Get-Mailbox -InactiveMailboxOnly | Format-List Name,DistinguishedName,ExchangeGuid,PrimarySmtpAddress
    

    Important

    Use the value of the DistinguishedName or ExchangeGUID property to identify the inactive mailbox. These properties are unique for each mailbox in your organization, whereas it's possible that an active and an inactive mailbox might have the same primary SMTP address.

  2. Create a variable that contains the properties of the inactive mailbox.

    $InactiveMailbox = Get-Mailbox -InactiveMailboxOnly -Identity <identity of inactive mailbox>
    
  3. Using the variable created from the previous command, create a new mailbox. This example recovers the inactive mailbox to an active mailbox for the user Ann Beebe. Be sure that the values specified for the Name and MicrosoftOnlineServicesID parameters are unique within your organization.

    New-Mailbox -InactiveMailbox $InactiveMailbox.DistinguishedName -Name annbeebe -FirstName Ann -LastName Beebe -DisplayName "Ann Beebe" -MicrosoftOnlineServicesID    Ann.Beebe@contoso.com -Password (ConvertTo-SecureString -String 'P@ssw0rd' -AsPlainText -Force) -ResetPasswordOnNextLogon $true
    

    The primary SMTP address for the recovered inactive mailbox will have the same value as the one specified by the MicrosoftOnlineServicesID parameter.

    After you recover an inactive mailbox, a new user account is also created. You need to activate this user account by assigning a license.

To restore an inactive mailbox using Exchange Online PowerShell, complete the following steps:

  1. Run the following command to get identity information for the inactive mailboxes in your organization.

    Get-Mailbox -InactiveMailboxOnly | Format-List Name,DistinguishedName,ExchangeGuid,PrimarySmtpAddress
    

    Important

    Use the value of the DistinguishedName or ExchangeGUID property to identify the inactive mailbox. These properties are unique for each mailbox in your organization, whereas it's possible that an active and an inactive mailbox might have the same primary SMTP address.

  2. Create a variable that contains the properties of the inactive mailbox.

    $InactiveMailbox = Get-Mailbox -InactiveMailboxOnly -Identity <identity of inactive mailbox>
    
  3. Obtain the LegacyExchangeDN of the inactive mailbox:

    $inactiveMailbox.LegacyExchangeDN
    
  4. Add the LegacyExchangeDN of the inactive mailbox as an X500 proxy address to the target mailbox.

    Set-Mailbox <identity of target mailbox> -EmailAddresses @{Add="X500:<LegacyExchangeDN of inactive mailbox>"}
    
  5. Restore the contents of the inactive mailbox to an existing mailbox.

    New-MailboxRestoreRequest -SourceMailbox $inactiveMailbox.DistinguishedName -TargetMailbox <identity of target mailbox> 
    

Delete and inactive mailbox

If you no longer need to keep the contents of an inactive mailbox, you can permanently delete the inactive mailbox by removing the hold applied it.

There are multiple methods to accomplish this behavior based off of the type of hold applied to the mailbox. For step-by-step instructions, see Delete an inactive mailbox.