How to Restore an Inactive Mailboxes in Office 365?

Megha Sharma | Updated On - 29 Dec 2020 |

Read time 5 min

This blog is for those who are looking for a method to restore the inactive mailboxes in Office 365. It includes information about inactive mailboxes and the manual tricks to restore them.
Generally, an Office 365 administrator makes a user mailbox inactive when its owner has left the organization, and the mailbox data needs to be saved for any time future use. The need to restore inactive mailboxes arise when

  • Any new employee joins the organization in place of the old employee
  • The employee who left the organization rejoins the organization

Office 365 administrators can get the list of inactive mailboxes through the Security & Compliance center in Office 365. Let us know how:

  1. Login to Office 365 using administrative credentials. Click Admin.
  2. Navigate to Security & Compliance > Data Governance > Retention.
  3. Click …. (more) on the Retention page and click the Inactive mailboxes option.
  4. It will list all the inactive mailboxes in your Office 365 organization.

You can also get the information about inactive mailboxes by running a cmdlet in Exchange Online PowerShell. For that, you need to connect Office 365 with Windows PowerShell first. Once connected, run this command.

Get-Mailbox -InactiveMailboxOnly | FT DisplayName,PrimarySMTPAddress,WhenSoftDeleted

Once you know about the inactive mailboxes, you can try to either restore or recover it. Before that you need to learn the difference between restoring and recovering of the inactive mailboxes.

When you restore an inactive mailbox, the inactive mailbox content along with its archive mailbox content gets merged to any existing mailbox. After the restoration, the inactive mailbox is retained in the same state.

While recovering an inactive mailbox, its content is recovered to a new mailbox, after which the inactive mailbox disappears. So, you will get a new mailbox with inactive mailbox content after performing the recovery.

How To Restore Inactive Mailboxes In Office 365?

First of all, connect your Windows PowerShell with Exchange Online like this:

  1. Run your Windows PowerShell as administrator (right-click on Windows PowerShell icon and click Run as Administrator).
  2. Now, run this command to set up an execution policy.
    Set-ExecutionPolicy RemoteSigned

    It will ask for confirmation. Type Y and press Enter.

  3. Set-ExecutionPolicy

  4. Run this command to add Office 365 credentials for configuration.
    $UserCredential = Get-Credential

    Provide the Office 365 account credentials and click OK.

  5. Next, run these two commands one-by-one for the final configuration of Exchange Online in PowerShell.
  6. $Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri -Credential $UserCredential -Authentication Basic -AllowRedirection


    Import-PSSession $Session -DisableNameChecking


  7. Now, we have successfully connected to Exchange Online PowerShell.

  1. First, create a variable using the properties of the inactive mailboxes. For that user should know the identities of the inactive mailboxes. So, run this command.
    Get-Mailbox -InactiveMailboxOnly | FL Name,DistinguishedName,ExchangeGuid,PrimarySmtpAddress

    To create a variable with inactive mailbox properties, execute the following cmdlet.

    $InactiveMailbox = Get-Mailbox -InactiveMailboxOnly -Identity <identity of inactive mailbox>

    At the place of bold text, enter any inactive mailbox identity received in the first step.
    To recover an inactive mailbox to an existing user mailbox in Office 365, execute this command in Exchange Online PowerShell.

    New-MailboxRestoreRequest -SourceMailbox $InactiveMailbox.DistinguishedName -TargetMailbox <mailbox address> -AllowLegacyDNMismatch

    Add target mailbox address in place of the bolded text in the command.
    Output: All the folders from the inactive mailbox are restored to the specified target mailbox instantly.

  2. If the user wants to restore the content to a top-level folder in the target mailbox, he can run this command:
    New-MailboxRestoreRequest -SourceMailbox $InactiveMailbox.DistinguishedName -TargetMailbox <mailbox address> -TargetRootFolder “Inactive Mailbox” -AllowLegacyDNMismatch

    Output: A new folder, namely inactive mailbox, is created within the target mailbox folder structure (top-level), and the inactive mailbox content moved to it.

  3. If inactive archive mailboxes are to be restored, these are the commands for you.
    First, create a variable for the inactive mailbox with its identity. To do this, run this command.

    $InactiveMailbox = Get-Mailbox -InactiveMailboxOnly -Identity <identity of inactive mailbox>

    Here, provide the inactive mailbox identity in place of the bold text.
    Next, run this command to restore the archive mailbox of the Inactive mailbox.

    New-MailboxRestoreRequest -SourceMailbox $InactiveMailbox.DistinguishedName -SourceIsArchive -TargetMailbox <mailbox address> -TargetIsArchive -TargetRootFolder “Inactive Mailbox Archive” -AllowLegacyDNMismatch

So, the restoration of inactive mailboxes could be performed through Exchange Online PowerShell with careful execution of the cmdlets. Try running cmdlets with some dummy mailboxes to check the process!