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, 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.
- 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 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.