As part of the larger mailbox moves we're doing, I developed this short function to sort an array of mailbox objects by their size. I was hoping that by feeding Move-Mailbox cmdlet a sorted list, it would move mailboxes faster. My theory being that if I started with the Largest mailboxes first, it would only take the longest mailbox time for all the moves. By sorting the list, it appears to have cut down on the doubling up of moves..
For example if my group contains:
(For example purposes) Say, I limit my moves 2 mailboxes at a time. By using an unsorted list, it could potentially move Tom(5gb) then Bob(10gb) on the same thread. (Thread 1= Tom, Bob; Thread 2 = Lisa, Fred, Paul) This could potentially create an extra-long move.
By sorting the mailboxes, I would Move Bob on one thread and Tom on the second thread. When Tom completes, it would pickup the remaining mailboxes. Possibly finishing the moves around the same time as (or even before) Bob's move.
Use:
Note about code. I still tend to double-check my mailbox counts before and after the sort. On one occasion, I had a null entry in my array (a distribution list was added) and it pulled an extra mailboxes. That is why I set the get-mailbox to only return 1 entry. At least it isn't 1000 extra.
Comments
Post new comment