How to Restore Inactive Mailboxes in Office 365?

Megha Sharma
Megha Sharma linkedin | Updated On - April 19, 2023 |

Read time 5 minutes

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 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 from the Security & Compliance center in Office 365. Let us know how:

  1. Login to Office 365 using administrative credentials. Click Admin.
  2. Login to Office 365

  3. Navigate to Security & Compliance > Information Governance > Retention.
  4. Navigate to Security

  5. Now, click the Inactive mailbox option.
  6. Inactive mailbox option

  7. It will list all the inactive mailboxes in your Office 365 organization.

You can also get 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 them. Before that, you need to learn the difference between restoring and recovering 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 the 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

    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.
    $Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://outlook.office365.com/powershell-liveid/ -Credential $UserCredential -Authentication Basic -AllowRedirection

    UserCredential

    Import-PSSession $Session -DisableNameChecking

    DisableNameChecking

    Now, we have successfully connected to Exchange Online PowerShell.

  1. First, create a variable using the properties of the inactive mailboxes. For that, users 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 is 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!

Restore inaccessible mailboxes from backup files

You can recover inactive mailboxes from backup files of Office 365 (in PST format) as well. For this, you need a professional tool like Kernel Office 365 Backup and Restore. With this tool, you can easily import single or multiple PST files to Office 365 with accuracy. An additional advantage is that it can be used to export Office 365 mailboxes to PST files. And it is a user-friendly tool that supports all Office 365 plans.

Summary

Sometimes organizations need to restore Office 365 mailboxes. This can be done easily from the Exchange admin center or using Exchange Management Shell. If you want to create backups for mailboxes and restore Office 365 mailbox from backups, you can use professional backup and restore Office 365 mailbox tool from KernelApps.