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?

  • If the user mailbox has not been logged in for a long time
    The reasons for this could be long leaves, no attendance, etc.
  • If the user mailbox has not received or sent emails for a long period
    Although there are mailbox settings ‘send only’ & ‘receive only’ for user mailboxes, long hibernating periods of user mailboxes without any mail flow is one of the signs of inactivity.
  • The employee has left the organization
    If the owner of the user mailbox has left the organization and the mailbox is not in use, but not deleted after his exit.

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)
    }

    Run cmdlets
    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

    Run command to save at desired location

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:
CSV File with the information

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.

Kernel for Exchange Server