September 3, 2010

Browsing Mailbox Databases in Exchange 2007 and 2010

A reader asks whether it is possible to browse through mailbox databases to view the details and statistics of the mailboxes they host on Exchange Server 2007 and 2010.  You might recall this was simple to achieve using the Exchange Server 2003 System Manager tools.

The nearest equivalent feature in the Exchange Management Console is using filters in the Recipient Configuration/Mailboxes section of the console.

However this feature does not expose mailbox statistics such as item count and total size.  For those types of details we can use the Exchange Management Shell instead.

For example, we can view the mailbox databases in the organization.

[PS] C:\>Get-MailboxDatabase

Name                           Server          Recovery        ReplicationType
----                           ------          --------        ---------------
Mailbox Database 1             EXCH2010-TEST   False           None
Mailbox Database 2             EXCH2010-TEST   False           None
Mailbox Database 3             EXCH2010-TEST   False           None
Mailbox Database 4             EXCH2010-TEST   False           None

Or to look at the mailboxes within a given database we can pipe one shell command into another.

[PS] C:\>Get-MailboxDatabase "Mailbox Database 1" | Get-Mailbox -ResultSize 15

Name                      Alias                ServerName       ProhibitSendQuota
----                      -----                ----------       -----------------
Administrator             Administrator        exch2010-test    unlimited
Aisha.Bhari               Aisha.Bhari          exch2010-test    unlimited
Alan.Reid                 Alan.Reid            exch2010-test    unlimited
Alannah.Shaw              Alannah.Shaw         exch2010-test    unlimited
Aldith.Walker             Aldith.Walker        exch2010-test    unlimited
Aleisha.Harrison          Aleisha.Harrison     exch2010-test    unlimited
Alex.Heyne                Alex.Heyne           exch2010-test    unlimited
Alice.Mullins             Alice.Mullins        exch2010-test    unlimited
Alison.Pugh               Alison.Pugh          exch2010-test    unlimited
Alison.Lindsay            Alison.Lindsay       exch2010-test    unlimited
Almaz.Duggan              Almaz.Duggan         exch2010-test    unlimited
Amanda.Watters            Amanda.Watters       exch2010-test    unlimited
WARNING: There are more results available than are currently displayed. To view them, increase the value for the
ResultSize parameter.

We can also look at statistics such as item count and total mailbox size of all mailboxes in a given database.

[PS] C:\>Get-MailboxDatabase "Mailbox Database 1" | Get-MailboxStatistics | Sort totalitemsize -desc | ft displayname, totalitemsize, itemcount

DisplayName                             TotalItemSize                                                         ItemCount
-----------                             -------------                                                         ---------
Administrator                           1.402 GB (1,505,666,188 bytes)                                            72179
EXCH2010-TEST 4FE1F90C-LGU000009        84.46 MB (88,567,215 bytes)                                                2977
EXCH2010-TEST 4FE1F90C-LGU000012        77.23 MB (80,986,155 bytes)                                                2568
EXCH2010-TEST 4FE1F90C-LGU000011        71.99 MB (75,483,699 bytes)                                                2489
EXCH2010-TEST 4FE1F90C-LGU000010        70.77 MB (74,204,704 bytes)                                                2523
EXCH2010-TEST 4FE1F90C-LGU000019        54.73 MB (57,390,302 bytes)                                                1917
EXCH2010-TEST 4FE1F90C-LGU000001        51.48 MB (53,980,482 bytes)                                                1725
EXCH2010-TEST 4FE1F90C-LGU000020        51.15 MB (53,634,243 bytes)                                                1725
EXCH2010-TEST 4FE1F90C-LGU000015        50.92 MB (53,394,939 bytes)                                                1725
EXCH2010-TEST 4FE1F90C-LGU000008        50.69 MB (53,153,806 bytes)                                                1725
EXCH2010-TEST 4FE1F90C-LGU000016        50.68 MB (53,138,572 bytes)                                                1725
EXCH2010-TEST 4FE1F90C-LGU000014        50.62 MB (53,079,853 bytes)                                                1741
EXCH2010-TEST 4FE1F90C-LGU000017        50.58 MB (53,035,273 bytes)                                                1725
EXCH2010-TEST 4FE1F90C-LGU000005        50.53 MB (52,980,645 bytes)                                                1725
EXCH2010-TEST 4FE1F90C-LGU000004        50.35 MB (52,795,218 bytes)                                                1725
EXCH2010-TEST 4FE1F90C-LGU000000        50.31 MB (52,755,053 bytes)                                                1725
EXCH2010-TEST 4FE1F90C-LGU000002        50.06 MB (52,490,485 bytes)                                                1725
EXCH2010-TEST 4FE1F90C-LGU000023        50.05 MB (52,486,337 bytes)                                                1725
EXCH2010-TEST 4FE1F90C-LGU000022        50.03 MB (52,464,722 bytes)                                                1725
EXCH2010-TEST 4FE1F90C-LGU000003        49.87 MB (52,292,132 bytes)                                                1725
EXCH2010-TEST 4FE1F90C-LGU000021        49.75 MB (52,170,805 bytes)                                                1725
EXCH2010-TEST 4FE1F90C-LGU000007        49.6 MB (52,006,854 bytes)                                                 1725
EXCH2010-TEST 4FE1F90C-LGU000024        49.44 MB (51,841,314 bytes)                                                1725
EXCH2010-TEST 4FE1F90C-LGU000018        49.31 MB (51,709,283 bytes)                                                1725
EXCH2010-TEST 4FE1F90C-LGU000006        48.64 MB (50,999,424 bytes)                                                1725
EXCH2010-TEST 4FE1F90C-LGU000013        29.46 MB (30,886,139 bytes)                                                 995

Alternatively, we can take a closer look at the mailbox statistics for one specific mailbox.

[PS] C:\>Get-MailboxStatistics -identity Administrator | fl

RunspaceId              : c3678368-5798-4340-8a0a-ab3f721b1a97
AssociatedItemCount     : 131
DeletedItemCount        : 0
DisconnectDate          :
DisplayName             : Administrator
ItemCount               : 72179
LastLoggedOnUserAccount : DOMAIN\Administrator
LastLogoffTime          :
LastLogonTime           : 1/14/2010 2:19:58 PM
LegacyDN                : /O=TEST ORG/OU=EXCHANGE ADMINISTRATIVE GROUP (FYDIBOHF23SPDLT)/CN=RECIPIENTS/CN=ADMINISTRATOR
MailboxGuid             : 9658e261-c681-40ac-ad6d-515791e28203
ObjectClass             : Mailbox
StorageLimitStatus      : BelowLimit
TotalDeletedItemSize    : 0 B (0 bytes)
TotalItemSize           : 1.402 GB (1,505,666,188 bytes)
Database                : Mailbox Database 1
ServerName              : EXCH2010-TEST
DatabaseName            : Mailbox Database 1
MoveHistory             :
IsQuarantined           : False
IsArchiveMailbox        : False
Identity                : 9658e261-c681-40ac-ad6d-515791e28203
MapiIdentity            : 9658e261-c681-40ac-ad6d-515791e28203
OriginatingServer       : exch2010-test.domain.local
IsValid                 : True

One of the common tasks that the Exchange Server 2003 System Manager was used for was exporting lists of mailbox users into CSV format for reporting in Excel. We can still achieve this in the Exchange Management Shell by exporting output to a CSV file.

[PS] C:\>Get-MailboxDatabase "Mailbox Database 1" | Get-MailboxStatistics | Sort totalitemsize -desc | ft displayname, totalitemsize, itemcount | Export-CSV C:\mailboxes.csv

The CSV output is formated correctly for easy import into Microsoft Excel.

As you can see although it may seem less intuitive than the previous method of browsing through a GUI the Exchange Management Shell actually makes it much simpler and easier to gather information about the mailboxes in your organization.

Leave a Comment

*