Get Mailbox Count per Database Efficiently

As part of our migration from SCC to CCR in our Exchange 2007 environment, I had to write a script that evacuated all of the users off of a given mailbox server across a collection of other servers while taking into account the number of mailboxes per server/database and available disk space (projected by quota) .  I can’t share the full script that I wrote, but I wanted to share a very useful method that I stumbled across to get the current count of mailboxes on the mailbox databases of a given server.

Normally the performance of the native Exchange Management Shell cmdlets is acceptable for daily administration, however for this process that we were using we discovered that enumerating 10,000 mailboxes to get a mailbox count per database wasn’t very efficient.

I basically took the method described over at sidefumbling and used it in the process and it saved me nearly 1 full minute per mailbox in the process which allowed us to perform the mailbox moves during a single tech window instead of having to split it across 2 different tech windows, subsequently allowing us to save a weeks worth of down time.

This entry was posted in Active Directory, Exchange 2007, PowerShell, References. Bookmark the permalink.