Monday, July 19, 2010

Gather Exchange 2010 mailbox information with a PowerShell command

When it comes to infrastructure reporting, different organizations require different levels of detail. For some organizations, understanding their Exchange footprint is simply a matter of identifying how much space is used by various Exchange databases. For other organizations, much more granular information is necessary, often requiring an understanding of individual mailbox sizes, and the number of items in each mailbox is considered important information. When it comes to detecting abandoned mailboxes, Exchange administrators might want to learn about the last time someone logged in to a particular mailbox. Fortunately, the PowerShell command get-mailboxstatistics can do all this and more. (There is a caveat to the Last Login Time; I address this later in the article.)

The get-mailboxstatistics command syntax is simple and requires one of three parameters to be specified:

  • Identity. Specify the user for which mailbox statistics should be gathered.
  • Database. Specify the database for which mailbox statistics should be gathered. All mailboxes in the target database will be listed.
  • Server. Specify the mailbox server for which mailbox statistics should be gathered. All mailboxes in all databases on the target server will be listed.

By default, get-mailboxstatistics returns the mailbox display name, the number of items present in the mailbox, the status of any storage limits that might be in place (e.g., is the mailbox meeting the administrator-imposed storage quotas?), and the time the mailbox was last used. Figure A shows the results from the get-mailboxstatistics command returning results at the database level.

Figure A


If you want to know exactly when you moved a mailbox from one server to another, you can use the -includemovehistory parameter, and you can have this information added to the output of the get-mailboxstatistics command. In Figure B, you’ll note that my mailbox was moved on 7/9/2010 at around 10:30 PM. The total move size was just under 5.6 GB and the process took almost one hour to complete. Also notice that this mailbox currently has no size limit; this is because we’re in the final pilot stages of our rollout to Exchange 2010, and a number of mailboxes have not yet been configured with new limits. (And, yes, my mailbox is huge, but it’s not as bad as it seems due to the way that I use my mailbox.)


Figure B


From a parameter perspective, the only other parameter of interest is -archive, which specifies that statistics regarding a related archive mailbox should be provided along with the main mailbox information.

Last Login Time caveat

As you saw in Figure A, all of the listed mailboxes were accessed in the same week; unfortunately, that’s not true, depending on how you look at it. The lastlogindate information stored with a mailbox reflects the last time that the mailbox was accessed for any reason, including brick-level Exchange backups. If you’re backing up Exchange in this way, the backup software logs in to the mailbox; hence, the login date information is useless.

Summary

Mailbox size information is important when it comes to space planning and other needs. As you move to Exchange 2010, this information can be invaluable. Bear in mind that Exchange 2010 completely does away with single instance messaging, which can significantly increase overall capacity needs, but there’s a tradeoff in lower IOPS needs. Understanding true space needs is a critically important planning step.

No comments:

Post a Comment