Waiting for a script to gather data can be a frustratingly long experience at times. A common task when using PowerShell cmdlets with Exchange 2010 is to enumerate mailboxes on a database. If you are counting the number of mailboxes per database using Get-Mailbox, it’s possible to speed things up. A faster method is to use Get-MailboxStatistics, although the cmdlets return different data, the mailbox count per database is what we want in a speedy manner. I’ve created two scripts with a timer built into each so that the speed of mailbox enumeration can be effectively illustrated. We are doing the following:
- Comparing Get-Mailbox versus Get-MailboxStatistics.
- Using a timer to illustrate the speed difference of counting mailboxes per database.
The test environment consists of 48 DAG databases with about 400 mailboxes on each, spread across four servers.