Get Exchange 2010 Move Information

When I’ve migrated mailboxes from Exchange 2003 to Exchange 2007, I was always asked how quickly the mailboxes moved. It wasn’t the easiest to figure this information out, but I was able to report on it after massaging the data for a while.

Exchange 2010 moves store the information differently and you can access that information much easier. I decided that I wanted to get a summary of all moves, so I wrote a script to automate the process.

I wanted to run the report pretty much every day and then after I did, save the information out to an HTML file for review.

My script is very plain, but provides all the basics that I’d ever need to report.

Add-PSSnapin Microsoft.Exchange.Management.PowerShell.E2010 -ErrorAction SilentlyContinue
$UserMoves = Get-ExchangeServer | Where-Object { $_.IsE14OrLater -and $_.IsMailboxServer } | Get-Mailbox -ResultSize Unlimited | Get-MailboxStatistics -IncludeMoveHistory
$MoveReport = @()
ForEach ( $Move in $UserMoves )
{
    if ( $Move.MoveHistory[0] )
    {
         # Get the most recent move history - ignore everything before this
         $MoveDetails = $Move.MoveHistory[0]
         $MoveItem = New-Object PSObject
         $MoveItem | Add-Member -MemberType NoteProperty -Name Mailbox -Value $Move.DisplayName
         $MoveItem | Add-Member -MemberType NoteProperty -Name SourceDB -Value $MoveDetails.SourceDatabase
         $MoveItem | Add-Member -MemberType NoteProperty -Name SourceVersion -Value $MoveDetails.SourceVersion
         $MoveItem | Add-Member -MemberType NoteProperty -Name TargetDB -Value $MoveDetails.TargetDatabase
         $MoveItem | Add-Member -MemberType NoteProperty -Name TargetVersion -Value $MoveDetails.TargetVersion
         $MoveItem | Add-Member -MemberType NoteProperty -Name BadItemLimit -Value $MoveDetails.BadItemLimit
         $MoveItem | Add-Member -MemberType NoteProperty -Name BadItemsEncountered -Value $MoveDetails.BadItemsEncountered
         $MoveItem | Add-Member -MemberType NoteProperty -Name StartTimestamp -Value $MoveDetails.StartTimestamp
         $MoveItem | Add-Member -MemberType NoteProperty -Name CompletionTimestamp -Value $MoveDetails.CompletionTimestamp
         $MoveItem | Add-Member -MemberType NoteProperty -Name OverallDuration -Value $MoveDetails.OverallDuration
         $MoveItem | Add-Member -MemberType NoteProperty -Name TotalInProgressDuration -Value $MoveDetails.TotalInProgressDuration
         $MoveItem | Add-Member -MemberType NoteProperty -Name MRSServerName -Value $MoveDetails.MRSServerName
         $MoveItem | Add-Member -MemberType NoteProperty -Name TotalMailboxSize -Value $MoveDetails.TotalMailboxSize
         $MoveItem | Add-Member -MemberType NoteProperty -Name TotalMailboxItemCount -Value $MoveDetails.TotalMailboxItemCount
         $MoveItem | Add-Member -MemberType NoteProperty -Name MoveSpeedBytesPerSec -Value ( $MoveDetails.TotalMailboxSize.ToBytes() / $MoveDetails.TotalInProgressDuration.TotalSeconds )
         $MoveItem | Add-Member -MemberType NoteProperty -Name MoveSpeedItemsPerSec -Value ( $MoveDetails.TotalMailboxItemCount / $MoveDetails.TotalInProgressDuration.TotalSeconds )
         $MoveReport += $MoveItem
    }
}
$MoveReport | ConvertTo-Html | Out-File -FilePath ( "D:ScriptsReportsMigrationSpeeds_" + ( Get-Date -Format "yyyyMMdd" ) + ".htm" ) -Force

Ramble On!

–Kevin

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.