Equal Number of Users Per Database
The second approach is to assign an equal number of users per database. Statistically, if the majority of your users have the same quota, database sizes should be similar. Obviously some databases will be larger than others but theoretically the database sizes should fall within a bell curve. To find the smallest database (in terms of mailboxes) we can group mailboxes by database and sort accordingly:
[PS] C:\Temp>Get-Mailbox -ResultSize:Unlimited | Group-Object -Property:Database | Select-Object Name,Count | Sort-Object -Property:Count
Assuming your edb file name is the same as the mailbox database name you can easily extract this information for mailbox provisioning:
[PS] C:\>$TargetDatabase = (((Get-Mailbox -ResultSize:Unlimited | Group-Object -Property:Database | Select-Object Name,Count | Sort-Object -Property:Count).Name).Split(”.edb”))
[PS] C:\>Enable-Mailbox -Identity:firstname.lastname@example.org -Database:$TargetDatabase
Pros: This method is ideal for load-balancing new mailboxes on multiple servers. When/if new mailbox databases are added to the Exchange system they will quickly be populated to match existing databases.
Cons: When you have a large number of mailboxes, grouping mailboxes by database can take quite a few seconds, even minutes. This time delay can become quite a bottleneck if you are creating a large number of mailboxes.
In part three I will detail randomly distributing mailboxes.