21 June 2012

Reduce the number of move requests

At a previous post (http://raunomagi.blogspot.com/2012/06/display-move-request-statistics-on.html) I found out that resuming all move-requests at once is probably not the best idea. First I would suspend all move requests and then start only few of them. Using the following script I will find completed ones and delete those requests and start new ones (in order small mailboxes –> huge mailboxes). Then the list gets smaller quicly, but last items will to their work quite long time.

while (get-moverequest)
{
if (get-moverequest -movestatus completed)
{
"get one completed move request"
get-moverequest -movestatus completed | select -first 1 | remove-moverequest -confirm:$false
"deleted that completed request, trying to find a suspended request to resume"
get-moverequest -movestatus suspended | Get-MoveRequestStatistics | sort totalmailboxsize | select -first 1 | foreach {Resume-MoveRequest $_.displayname}
"move request having smallest mailbox size is resumed"
}
"now sleeping a minute"
for ($i=1; $i -le 60; $i++)
{
Write-Host "." -nonewline
sleep 1
}
Write-Host
"waking up"
}
"seems like everything is done now"

No comments:

Post a Comment