Tuesday, 24 July 2012

Balancing / Dispersing Mailboxes between Exchange 2010 Databases

I recently needed a script that would balance mailboxes between databases. Similar scripts exist, but I wanted one that specifically met all of my requirements. This script is very simple, but does exactly what I need. For now at least…
My needs
  • The ability to maintain the number of users across an Exchange 2010 DAG with up to 30,000 users. Size of the mailboxes wasn’t that important as there is only one quota across all mailboxes.
  • The ability to exclude certain mailboxes, in my case Symantec Enterprise Vault Archiving Mailboxes.
  • The ability for the script to be scheduled with ease. A lot of the scripts that exist, generate a “move list”, I didn’t want that.
  • E-Mail status reports after processing.
Logic
The script will discover the number of users, then discover the number of databases. It will then find the optimum number of users per database and create a move request ensuring that all but one of the databases contain the same number of users. It will then send an e-mail detailing what it’s done.
There script will skip mailboxes with a display name beginning with “GIG_EVMailbox” you can change that string to skip what you need it to skip.
The script in action
image
The Powershell script is available here…. https://docs.google.com/open?id=0B7OxVSEjnHfickV3aVN4RWw4ZTg .
I hope you find it useful.