Exchange – Get Disconnected Mailboxes

get disconnected mailboxesToday I was visiting a customer I am helping to optimize the Exchange infrastructure, during our discussion I learned they have not proper policies in place to mange mailboxes of users who left organization and, more in general, disconnected mailboxes.

I was tasked to get disconnected mailboxes that were still residing on the Exchange database wasting space and precious resources, while the number of disconnected mailboxes can be easily gathered through Exchange GUI I needed some more structured data to present to the customer,let’s see how.

To get disconnected mailboxes you can use the following command within an Exchange Management Shell session:

Get-MailboxDatabase | Get-MailboxStatistics | where {$_.DisconnectReason -ne $null} | Select-Object DisplayName, @{Name="TotalItemSize(MB)";Expression={$_.TotalItemSize.Value.ToMB()}}, LastLogonTime, DisconnectDate |sort "TotalItemSize(MB)" -Descending

The above command will get all disconnected mailboxes showing you their Name, the Total Size in MB, last time the user logged in to the mailbox and the disconnection date, this data can be easily exported to a CSV file which you can then modify with Excel, using the above command I was able to show the customer they were wasting quite a few gigabytes of space only for disconnected mailboxes.

By default Exchange will keep disconnected mailboxes for 14 days before purging them, assuming they’ve been backed up, in a separate article I will show how to manually purge disconnected mailboxes.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s