This website uses cookies to improve your experience. We'll assume you're ok with this. Know more.

How to Get Inactive Mailbox Report in Exchange Online

Not keeping tabs on Microsoft 365 inactive mailboxes can lead to severe security vulnerabilities, compliance gaps, and unnecessary licensing costs. However, no need to worry! We've got you covered with our practical solutions to find and manage inactive mailboxes in Exchange Online. Act now for a secure Exchange Online environment!

Native Solution

Microsoft 365 Permission Required

High

Global Admin or an Exchange Admin.

Option 1 Using Exchange Online Admin Center

  • Login to the Exchange Online admin center.
  • Navigate to Recipients»Mailboxes. Click on the desired user.
  • Under the General tab, you can find the user's last logon time in Exchange Online.
Using Exchange Online Admin Center

Option 2 Using Windows PowerShell

  • Connect to Exchange Online PowerShell using the below cmdlet.
  • Windows PowerShell Windows PowerShell
     Connect-ExchangeOnline -UserPrincipalName <UPN>
  • Run the below cmdlet to get inactive mailboxes using PowerShell. It provides various details like the user display name, last logon time, and users’ last activity time.
  • Windows PowerShell Windows PowerShell
     Get-Mailbox -ResultSize Unlimited | Foreach{Get-MailboxStatistics -Identity $_.UserPrincipalName | Select DisplayName,LastLogonTime,LastUserActionTime}
Using Windows PowerShell
  • Thus the 'Get-Mailbox' cmdlet has retrieved all the Exchange Online mailboxes with the user's activity time.

Option 3 Using PowerShell Script

  • Do you feel it would be beneficial to obtain users' last logon time along with the number of inactive days? Here is a PowerShell script designed to find the last logon time in Exchange Online, including the duration of their inactivity.
  • Download and run the following script in the Administrator PowerShell.
Using PowerShell Script
AdminDroid Solution
More than 150 reports are under free edition.

AdminDroid Permission Required

Any user with report access delegated by the Super Admin.

StepsUsing AdminDroid

ad
  • Login to the AdminDroid Office 365 reporter.
  • Navigate to the By User’s Last Activity report under Reports»Exchange»Inactive Mailboxes.
Using AdminDroid

Stay updated about the complete list of Microsoft 365 users' last activity time along with the license status, mailbox size, and mailbox type.

last-logon-charts
  • Employ the built-in graphical representation to identify the holds placed on Exchange Online mailboxes, such as In-Place holds and Litigation holds.

Manage inactive mailboxes in Exchange Online!

Inactive mailboxes may increase data security risks over time - Secure your Exchange Online by effectively managing inactive mailboxes using AdminDroid.

Witness the report in action using the

Important Tips

Find unused Exchange Online mailboxes and revoke their Microsoft 365 licenses, thereby enhancing resource allocation and improving security.

Audit the activities of enabling and disabling mailboxes to identify mailbox enabled users and disable them if they remain inactive for a prolonged period.

Find the inactive archived mailboxes in Exchange Online based on their last logon time and disable unnecessary archived mailboxes to prevent storage issues.

Exchange OnlineFind Inactive Mailboxes to Prevent Data Breaches in Microsoft 365

Showing 1 of 5

How to create an inactive mailbox in Microsoft 365?

Inactive mailboxes are used to retain former employee’s data to preserve sensitive information after they leave the Microsoft 365 organization.
You can create inactive mailboxes to retain mailbox content indefinitely by deleting the user account configured with Microsoft 365 retention policies or holds. Follow the steps below to configure the Microsoft 365 retention policy for an Exchange Online mailbox.

  • Login to the Microsoft 365 Purview portal. Navigate to Data lifecycle management»Microsoft 365.
  • Under the Retention policies tab, click on ‘+New retention policy’ to create a new Microsoft 365 retention policy.
  • Give a name for the retention policy and then select the administrative units that you’d like to apply to this policy.
  • You can choose either Adaptive or Static as per your requirement. If you choose Adaptive, then you must include the adaptive scopes to dynamically apply the policy. If you choose Static, then you can include only the desired mailboxes.
  • You can specify the retention settings like retaining items for a specific period, retaining items forever, and deleting items after a certain period, etc.
  • Review your settings and click on Submit. Now, the policy will be applied to the desired mailboxes.

After configuring the data retention policy for a user’s Exchange Online mailbox who is leaving your organization, you can delete the Microsoft 365 user account using PowerShell.

Remove-MgUser –UserId "<UserObjectID>"

How to identify the type of hold placed on an Exchange Online mailbox?

Using AdminDroid, you can check if a mailbox is on hold and remove unnecessary holds or retention policies before deleting a Microsoft 365 user account.

  • Here, you can get the entire details of the mailboxes on hold, such as primary SMTP address, mailbox size, inactive days, etc.
  • Pro Tip: Make use of the In-Place Holds easy filter to get all mailboxes on specific hold. You can also check Litigation hold status of a user’s Exchange Online mailbox and remove it if you are not willing to retain its contents.
mailbox-on-hold

How to restore an inactive mailbox in Microsoft 365?

You can restore the inactive Exchange Online mailbox of an ex-employee and provide mailbox content access to other active users in your Microsoft 365 organization. Follow the steps below to restore an inactive mailbox in Office 365.

  • Connect to Exchange Online PowerShell using the below cmdlet.
    Connect-ExchangeOnline -UserPrincipalName <UPN>
  • Specify the mailbox to be restored in a separate variable.
    $inactiveMailbox = Get-Mailbox -InactiveMailboxOnly -Identity <ExchangeGuid of inactive mailbox>
  • Before restoring an inactive mailbox, it is mandatory to add the LegacyExchangeDN of the inactive mailbox as an X500 proxy address to the target mailbox. This helps in maintaining the proper routing of emails to the target mailbox.
    $inactiveMailbox.LegacyExchangeDN
    Set-Mailbox <ExchangeGuid of target mailbox> -EmailAddresses @{Add=X500:"<LegacyExchangeDN of inactive mailbox>"
  • Merge the contents of the inactive mailbox into the corresponding folders of the target mailbox using the below cmdlet.
    New-MailboxRestoreRequest -SourceMailbox $inactiveMailbox.DistinguishedName -TargetMailbox <ExchangeGuid of target mailbox>
  • Check the progress of the mailbox restore request to make sure it is completed successfully.
    Get-MailboxRestoreRequest | Select-Object DisplayName, Identity
    Get-MailboxRestoreRequest -Identity <Identity of the desired mailbox restore request>

Pro Tip: When an Exchange Online inactive mailbox is restored, only the contents are copied to another mailbox. However, it is still considered as an inactive mailbox and can be searched using eDiscovery.

Using AdminDroid, you can audit the mailbox restoration activities performed in your Exchange Online environment.

  • Here, you can get the details of the mailbox restoration activity, such as restored mailbox, restored time, and restored by.
  • You can get alerted whenever a new mailbox restore request is created by configuring an AdminDroid alert policy with filters.
  • Alert policies can be created from the Alerts tab of the AdminDroid portal.
mailbox-restore-alert

How to recover an inactive mailbox in Microsoft 365?

You can recover a former employee’s inactive mailbox by granting access to a new Microsoft 365 user in your organization. This process converts the inactive mailbox into an active mailbox that contains all the recovered contents.

  • Connect to Exchange Online PowerShell using the below cmdlet.
    Connect-ExchangeOnline -UserPrincipalName <UPN>
  • Specify the mailbox to be recovered in a separate variable.
    $inactiveMailbox = Get-Mailbox -InactiveMailboxOnly -Identity <ExchangeGuidofInactiveMailbox>
  • Run the below cmdlet to convert the inactive mailbox into a new active mailbox in your organization.
    New-Mailbox -InactiveMailbox $InactiveMailbox.DistinguishedName -Name <Name> -FirstName <First name> -LastName <Last Name> -DisplayName "<Display Name>" -MicrosoftOnlineServicesID <User Principal Name> -Password (ConvertTo-SecureString -String '<Password>' -AsPlainText -Force) -ResetPasswordOnNextLogon $true

After recovering an inactive mailbox, a new Microsoft 365 user account is created in your organization. To activate this account, simply assign a license through your Microsoft 365 admin portal.


Note: When you recover an inactive mailbox, it gets completely converted to an active mailbox and is linked to a new user account. Subsequently, it is no longer classified as inactive.

How to find inactive mailboxes in Microsoft 365?

An Exchange Online mailbox can become inactive if a Microsoft 365 retention policy or hold is applied to it before deleting the user account. To manage these deleted mailboxes efficiently, get the Exchange Online inactive mailbox report and remove any holds or retention policies once the mailbox content is no longer required to be retained.

Get inactive mailbox from Microsoft Purview portal

  • Login to the Microsoft 365 Purview portal. Under Solutions, navigate to Data lifecycle management»Microsoft 365.
  • Under the Retention policies section, click on the Inactive mailbox tab to get a list of inactive mailboxes in Microsoft 365.

Get inactive mailbox using PowerShell

  • Run the below cmdlet to find the inactive mailbox report using PowerShell.
Get-Mailbox -InactiveMailboxOnly -ResultSize Unlimited | FT DisplayName,PrimarySMTPAddress,WhenSoftDeleted

With AdminDroid, you can easily find deleted mailboxes in Exchange Online and remove the retention policies or holds applied if you don’t need to retain their contents.

  • Here, you can get the entire details of the deleted mailboxes, such as deleted time, user display name, email address and performed delete action.
  • Pro Tip: Using the Column Customization feature, you can customize the report by adding various columns, such as Is Inactive Mailbox, In-Place Holds, and Litigation Hold. You can then decide to remove the holds on inactive mailboxes.
deleted-mailboxes

How to delete an inactive mailbox in Microsoft 365?

Once you no longer require the contents of an inactive mailbox, you can permanently delete the mailbox by removing all holds on it. Subsequently, the inactive mailbox is automatically flagged for deletion and will be permanently removed after processing.


Before removing the holds, you must identify the type of hold placed on an Exchange Online mailbox. You can identify them by running the below cmdlets in your Exchange Online PowerShell.

Get-Mailbox -Identity <IdentityofInactiveMailbox> -InactiveMailboxOnly | FL DisplayName,Name,DistinguishedName,ExchangeGuid,IsInactiveMailbox,LitigationHoldEnabled,LitigationHoldDuration,LitigationHoldDate,LitigationHoldOwner,InPlaceHolds,ComplianceTagHoldApplied

Run the below PowerShell cmdlet to remove an inactive mailbox from a retention policy that is configured at the organization level.

Set-Mailbox <Identity of inactive mailbox> -ExcludeFromOrgHolds <Retention policy GUID without prefix or suffix>

You can also remove an inactive mailbox from all the retention policies configured at the organization level.

Set-Mailbox <Identity of inactive mailbox> -ExcludeFromAllOrgHolds

Run the below PowerShell cmdlet to remove an inactive mailbox from a retention policy configured for specific mailboxes.

Set-RetentionCompliancePolicy -Identity <Retention policy GUID without prefix or suffix> -RemoveExchangeLocation <Identity of inactive mailbox>

Run the below PowerShell cmdlet to remove a Litigation hold from an inactive mailbox.

Set-Mailbox -InactiveMailbox -Identity <Identity of inactive mailbox> -LitigationHoldEnabled $false


After removing the holds or retention policies on an inactive mailbox, it is considered a soft-deleted mailbox and is marked for permanent deletion after 30 days.

AdminDroid Exchange Online ReporterTrack inactive Exchange Online mailboxes at ease!

The AdminDroid Exchange Online management tool helps you to find and manage inactive mailboxes in your Microsoft 365 environment by providing reports on mailbox usage, as well as information on holds and retention policies applied to them.

AdminDroid’s standout features to manage inactive mailboxes in Exchange Online

The Inactive Mailboxes by User's Last Activity Time report displays the last activity time of users on their Exchange Online mailboxes. By checking this report frequently, you can determine whether a user is actively interacting with others through their Exchange Online mailbox.

An Overview

Mailbox Audit Logs in Microsoft 365

Keep an eye on mailbox owner access logs to find whether the mailboxes in your Exchange Online environment are being used regularly.

Check Login History in Exchange Online

Look into the mailbox login activities in your Microsoft 365 environment to prevent unauthorized access and meet compliance requirements.

Data Loss Prevention in Exchange Online

Easily monitor DLP policy matches to prevent leakage of sensitive information from Exchange Online mailboxes.

Microsoft 365 GDPR Compliance Management

Ensure that any personal information in inactive mailboxes is handled in compliance with GDPR requirements with AdminDroid.

Mailbox Usage Reports in Microsoft 365

Access comprehensive mailbox usage reports seamlessly from a centralized hub, thereby streamlining Exchange mailbox management.

Effortless Exchange Online Mailbox Management

Get a complete information of Exchange Online mailboxes in a single place and manage each mailbox activity in your organization.

AdminDroid transforms the intricate task of managing inactive mailboxes into a breeze for Exchange Online admins. Its sophisticated reporting capabilities empower you to take proactive measures, such as disabling mailboxes, assigning different retention policies, and restoring inactive mailboxes.

Kickstart Your Journey with AdminDroid

Your Microsoft 365 Companion with Enormous Reporting Capabilities!

Common Errors and Resolution Steps for finding inactive mailboxes in Microsoft 365

The following are the possible errors and troubleshooting hints while dealing with inactive mailboxes in Office 365.

Error: Get-Mailbox: A parameter cannot be found that matches parameter name 'InactiveMailboxOnly'

This error occurs when you don’t have sufficient permission to read the inactive mailboxes in Exchange Online.

Troubleshooting hint :Ask your Global Administrator to assign the "View-Only Recipients" role using the below cmdlet.

Add-RoleGroupMember -Identity "View-Only Recipients" -Member <UserDisplayName>

Error: Exchange can't disable mailbox because it is on In-Place Hold.

This error occurs when you try to disable a mailbox configured with a retention policy.

Troubleshooting hint :Run the below PowerShell cmdlet to remove the inactive mailbox from all the retention policies configured at the organization level.

Set-Mailbox <IdentityofInactiveMailbox> -ExcludeFromAllOrgHolds

Error: Write-ErrorMessage : |Microsoft.Exchange.MailboxReplicationService.MailboxLacksArchivePermanentException|Mailbox '<User Guid>' has no archive

This error occurs if the target mailbox has a disabled archive while restoring an inactive archive mailbox.

Troubleshooting hint :Run the below PowerShell cmdlet to enable archive for the target mailbox.

Enable-Mailbox -Identity <UserPrincipalName> -Archive

Error: The term 'Get-Mailbox' is not recognized as the name of a cmdlet.

This error occurs when you have not connected to the Exchange Online PowerShell.

Troubleshooting hint :Connect to the Exchange Online PowerShell using the below cmdlet.

Connect-ExchangeOnline -UserPrincipalName <YourAdminAccount>

Error: Write-ErrorMessage : Ex6F9304|Microsoft.Exchange.Configuration.Tasks.ManagementObjectNotFoundException|The operation couldn't be performed because object 'Exchange GUID' couldn't be found on 'SA9PR11A10DC003.NAMPR11A010.PROD.OUTLOOK.COM'

This error occurs when the Exchange GUID of the mailbox is wrong.

Troubleshooting hint :Run the below cmdlet to get mailbox GUID using PowerShell.

Get-Mailbox -Identity <MailboxIdentity> | Format-List *GUID,MailboxLocations