PowerShell script that evenly distributes the number of Exchange mailboxes per database
Download the Optimize-MailboxesPerDatabase.ps1 file
Redistribute mailboxes
.\Optimize-MailboxesPerDatabase.ps1 -Databases 'USDAG-003', 'USDAG-062', 'USDAG-262'
Redistribute mailboxes, move the smallest mailboxes
.\Optimize-MailboxesPerDatabase.ps1 -Databases 'USDAG-003', 'USDAG-062', 'USDAG-262' -BySize Smallest
Redistribute mailboxes, move the largest mailboxes
.\Optimize-MailboxesPerDatabase.ps1 -Databases 'USDAG-003', 'USDAG-062', 'USDAG-262' -BySize Largest
Redistribute mailboxes for all Databases
$Databases = Get-MailboxDatabase
.\Optimize-MailboxesPerDatabase.ps1 -Databases $Databases.Name
Environment Tested on: Exchange 2016 CU5
Total Databases: 265
Total Mailboxes: 7175
Creating New Move Requests during actuall run time will vary depending on your environment. Using the WhatIf parameter I measure the command run time with the below results.
Average RunTime: 60 Seconds
Filtering for Largest mailboxes: 9 minutes
Filtering for smallest mailboxes: 4 minutes
If the script processing time is to long you may want to look into incorporating Invoke-Parallel in to the script. https://github.com/RamblingCookieMonster/Invoke-Parallel
- Fork it!
- Create your feature branch:
git checkout -b my-new-feature
- Commit your changes:
git commit -am 'Add some feature'
- Push to the branch:
git push origin my-new-feature
- Submit a pull request :D
This project is licensed under the MIT License - see the LICENSE.md file for details