Using PowerShell to Retrieve Exchange Mailbox Statistics for Office 365 Migrations

Recently, I’ve been working on trying to finish up a migration from Exchange Server 2010 to Office 365. There are potentially numerous mailboxes that aren’t used and those won’t be migrated to Office 365 because there’s no sense in paying for licensing for them.

How do you determine what mailboxes are in use?

First, use implicit remoting to load the Exchange cmdlets locally. Years ago, I would install the Exchange cmdlets locally, but it was brought to my attention that it’s unsupported, at least according to this article: “Directly Loading Exchange 2010 or 2013 SnapIn Is Not Supported“.

Next retrieve a list of all mailboxes with Get-Mailbox and pipe those results to Get-MailboxStatistics. I’ve silenced any warnings, otherwise the output may be littered with warnings for users who have never logged into their mailbox. Sorting the results by LastLogonTime in descending order places the most recently accessed mailboxes at the top of the list. Since I’m returning more than four properties and I want them in a table, I’ll pipe to Format-Table and specify the properties I’ve found to be the most useful.

Specifying Last* for one of the properties returns the LastLoggedOnUserAccount, LastLogoffTime, and LastLogonTime. LastLogoffTime may not always be accurate or populated. At first, I thought the results were inaccurate due to an old account showing up with a recent LastLogonTime. The LastLoggedOnUserAccount for that account showed that someone else was accessing it which made more sense.

Thoughts, questions, comments? Please post them as a comment to this blog article.

µ

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: