Redistribute \ Balance Mailboxes Across Databases Exchange 2013\2016 - Update 1

The Script is Updated for a Bug Fix that was reported on January 14th 2020This script will take the databases in your exchange organization and will calculate and run reports against mailboxes balance and distribution across all databases. there is a final report called FinalRepo

5 Star
1,845 times
Add to favorites
E-mail Twitter Digg Facebook
  • Script Errors
    4 Posts | Last post January 15, 2020
    • Export-Csv : Cannot bind argument to parameter 'InputObject' because it is null.
      At C:\Scripts\RedistributeMailboxes.ps1:300 char:24
      +     $MoveInitiatedArray | Export-Csv "$LogPath\MoveInitiated.csv" -NoTypeInformatio ...
      +                           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
          + CategoryInfo          : InvalidData: (:) [Export-Csv], ParameterBindingValidationException
          + FullyQualifiedErrorId : ParameterArgumentValidationErrorNullNotAllowed,Microsoft.PowerShell.Commands.ExportCsvCo
      the ErrorLog.csv says You cannot call a method on a null-valued expression.
    • I am getting the same error as reported by Brandon and the "" file turns out to be empty.However the script moves the no.of mailboxes I chose. Can someone pls help me with the error?
    • thank you both of you for pointing out the Error. I have fixed the error and it should be good now. I had not created the Array Object for moveinitiated. Please try now and let me know if all is good. 
    • Thanks a lot Riaz for quickly fixing it. I tested it again and it worked well.The "MoveInitiated.csv" is populated now and the script does not throw any error. Appreciate it.
  • Database Space Option
    1 Posts | Last post December 06, 2019
    • Just curious if you had a chance to work on a script to redistribute based on space yet? I see you still hadn't had a chance yet back in June. Thought I would ask for those of us still wondering if that option is out there. 
  • Does not deal with user archive databases properly
    1 Posts | Last post October 08, 2019
    • We have separate mailbox databases (on larger, but slower spindles) for ArchiveDatabases.
      First, I had to filter those out of the $DBs = Get-MailboxDatabase line.  
      Hoever, the New-MoveRequest code does not check to see if an archive DB exists, so moves both to the new mailboxdb.  As a quick fix I modified the New-MoveRequest line by adding -PrimaryOnly.
  • Script seems to be moving more mailboxes to one database over the others
    2 Posts | Last post June 11, 2019
    • A colleague of mine and I edited the script slightly so it prompts us and asks if we wish to balance mailboxes in Archive datastores, MBX (user mailboxes), or from one of two physical sites, and so far it works great. What we would like to do is start the script and walk away, but after analyzing it, it determined over 130 mailboxes initially to be redistributed. Unfortunately, the amount of logfiles generated during this activity fills up the logfile drives and we have to continuously add more storage to the logfile drives.
      Last night I ran the script but instead of letting it run and move all of the mailboxes it analyzed, I specified 5 mailboxes, which it moved from various locations to MBX02 database. Now this database is critical and down to 6% free space. I'm concerned now that we will have to add more space to this database, when it should be moving mailboxes to other databases with free space. Is there a way to analyze the space in the database itself? How can I be sure that the script wont try and move more mailboxes to MBX02?
    • Yes that is the exact reason i had provided interactive confirmation if you want to move all mailboxes if not then asks you to provide how many you want to move. moving mailboxes creates log files twice as much the size of the mailbox. you need to do this carefully or  you can always adjust the script and add functionality to do space verification as well. If i ever get some time i will certainly work to add space check option to the script.  
  • Can I exclude my 'Archive' databases as available resources?
    3 Posts | Last post April 10, 2019
    • Hello,
      Thank you for the script.  I was able to run it with no issues, however when I took a look at the final report, I noticed that it was suggesting to move mailboxes from their current database to an archive database.  How can I exclude this as an option?
    • Feel free to adjust the script as you wish. You can simply add condition to exclude any database that you would like. I usually make my scripts that i work for my organization available here. i can certainly look into providing that option if i get some free time :) 
    • You can change line 20 of script to below
      $DBs = Get-MailboxDatabase -Status | where-object {$_.Name -ne 'PFDB001'} | Sort Name
  • Exclude Mailbox Databases from Redistribution
    2 Posts | Last post February 15, 2019
    • Hi Riaz 
      Thank you for this script it helps alot. Can I a suggestion that you add a function to Exclude Mailbox Database that are not in a Database Management Scope for Redistribution.
    • That is a wonderful suggestion, I will do that as soon as i have some time :). I make my scripts available here when I feel it can be useful for you fine folks out there. so feel free to make changes to it to fit your organization needs
  • Databases that IsExcludedFromProvisioning is True, still considered
    1 Posts | Last post November 19, 2018
    • Hello,
      I would like to thank you for the script that helps a lot. also if i may, i allowed myself to modify few things to be more automated on my system.
      i noticed something while i ran it the first time, it still consider to move mailboxes to databases that has IsExcludedFromProvisioning true.
      can you take a look at it ?
      thank you
  • Hello, i have a database "test" where i don't want to move user
    2 Posts | Last post August 22, 2018
    • Hello, Thank you for the script. 
      I have a TEST database where i don't create user. It is a non-production database. How can i exclude a database from the balance ?
      Thanks you
    • Just exclude the TEST database from provisioning.
      Set-MailboxDatabase -Identity "TEST Mailbox Database" -IsExcludedFromProvisioning $true
  • Will this work for Exc 2010 sp3
    2 Posts | Last post August 15, 2018
    • Can this distribute mailboxes based on storage space ? I want to run it for exc 2010
    • NO this is just a basic one that is not based on storage space. I will work on one that is based on storage space as soon as i have some time