Kernel Data Recovery Blog

How to get inactive mailboxes in Exchange Server?

Read time 4 minutes

Summary: Once an Exchange mailbox is deleted, it becomes soft-deleted and inactive. You can recover data from these inactive mailboxes up to their retention period, which is 30 days (by default). This article shares some significant practices to find inactive mailbox Exchange Online and get list of inactive mailboxes Office 365 PowerShell. Once you have the mailboxes, you can use tools like Kernel for Exchange Server to restore and export inactive mailbox to PST.

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, the Exchange administrator needs to keep their mailboxes to store data and to abide by the retention policies. This purpose can be fulfilled using the inactive mailboxes. 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?

An Exchange user mailbox can be inactive for a lot of reasons such as upon deletion, soft deletion with the hold state, or after getting disconnected. The following points explain some scenarios when a mailbox enters into inactive state.

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 Office 365 in the Exchange Server environment first.

Methods to get inactive mailbox using Exchange Management Shell

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.

Step 1. Open the Exchange Management Shell on your Exchange system. Run this cmdlet 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

Step 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:

Find inactive mailbox Exchange Online using PowerShell

You can use Windows PowerShell to connect and find inactive Exchange Online mailboxes with the following procedure:

Step 1. Run the following cmdlet in PowerShell to connect with Exchange Online

Connect-ExchangeOnline -UserPrincipalName

Step 2. Use the following cmdlet to

Get-Mailbox -ResultSize Unlimited | Foreach{Get-MailboxStatistics Identity $_.UserPrincipalName | Select DisplayName,LastLogonTime,LastUserActionTime}

This command yields a list of mailboxes with the details like User display name. last logon time, and last user activity.

How to find inactive mailboxes office 365?

To get the list of inactive mailboxes in Office 365, use either the PowerShell scripting or EAC as mentioned in further sections.

Get inactive mailbox office 365 PowerShell

Use the following command in PowerShell to get list of inactive mailboxes office 365 PowerShell:

Get-Mailbox -InactiveMailboxOnly | Format-List Name,DistinguishedName,ExchangeGuid,PrimarySmtpAddress

Using Exchange admin center to find inactive mailboxes office 365

The other method you can use Office 365 is using Exchange admin center to find inactive mailboxes Office 365. Here are the steps to follow:

Step 1. Login to Exchange admin center using the administrator credentials.

Step 2. From the left window pane, go to Recipients and then click on Mailboxes.

Step 3. Click on any user mailbox to find the details.

Step 4. There, you can check the last logon time of the user and find inactive mailbox office 365.

Limitations of manual method to get list of inactive mailboxes office 365 PowerShell

Hence, you can see finding inactive mailboxes in Exchange Server 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. To run these PowerShell scripts, you’ll also need some assigned permissions, including local administrator, remote PowerShell access, and Exchange Organization Management role.

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 export inactive mailbox to PST, save them to multiple destinations such as Exchange and Office 365. The Exchange recovery 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, to recover mailboxes in Exchange and restore inactive mailbox.