Kernel Data Recovery Blog

Finding inactive mailboxes in Exchange Server environment

Read time 4 minutes

Each business must follow some retention standards to keep their older data, documents, and even mailbox for a lengthy period. Even when an employee leaves the organization, then the manager needs to keep their mailboxes to maintain the retention. You must create some inactive mailboxes in the Exchange Server that are not accessible to any user, but they remain present in the database.

When does an Exchange user mailbox become inactive?

All such situations may cause mailboxes to be inactive. At certain times, these mailboxes are needed to be removed from the Exchange environment due to various reasons such as migration needs, cost reduction requirements, managing storage space, IT resource auditing, etc. To remove inactive mailboxes, you have to find inactive mailboxes in the Exchange Server environment first.

The best manual technique to find inactive mailboxes is running PowerShell commands in the Exchange Management Shell. Follow the given steps to get the information about inactive mailboxes in Exchange Server.

  1. Open the Exchange Management Shell on your Exchange system. Run this cmdlets to get the information of inactive mailboxes for a period of last 90 days within your Exchange organization.
    $mailboxes = Get-Mailbox -ResultSize Unlimited
    $mailboxes | ?{
    (Get-MailboxStatistics $_).LastLogonTime -and `
    (Get-MailboxStatistics $_).LastLogonTime -le `
    (Get-Date).AddDays(-90)
    }


    This would scan and display the Exchange database to get the mailbox(es) inactive for the last 90 days, based on last logon timings. You can modify the number of days according to your requirement, say here from 90 to 100 days.
    Note: You can run this command and get the same results.

    Get-Mailbox -ResultSize Unlimited | Get-MailboxStatistics | Where{$_.Lastlogontime -lt (Get-Date).AddDays(-90)} | Select DisplayName, LastLoggedOnUserAccount, LastLogonTime
  2. For storing the received information in the CSV file at the desired location, you can run this command.
    Get-Mailbox -ResultSize Unlimited | Get-MailboxStatistics | Where{$_.Lastlogontime -lt (Get-Date).AddDays(-35)} |Select DisplayName, LastLoggedOnUserAccount, LastLogonTime | Export-csv C:\Root\InactiveUsers.csv

The CSV file with information like Display Name of user mailboxes, Last Logon date and time will get saved at the defined location. It displays like this:

Hence, you can see finding inactive mailboxes in Exchange Serve is possible by running commands in the Exchange Management Shell. There could be a condition that certain Exchange mailboxes, including the inactive ones, are not accessible to users due to corruption issues. The big corruption issues cannot be handled by manual solutions like Eseutil utility. So, we suggest you try the third-party tool, Kernel for Exchange Server tool to recover inaccessible Exchange mailboxes efficiently and save them to multiple destinations such as Outlook PST, Exchange and Office 365. The software supports all Exchange Server versions to repair corrupt Exchange Server database.

Summing Up

Inactive Exchange mailboxes indirectly or directly hinder its efficiency and management of data. Details of inactive mailboxes can be obtained by running some cmdlets in Exchange PowerShell. Also, we have recommended an effective EDB recovery tool for dealing with corrupt EDB files and to recover mailboxes including the inactive ones.