Powershell: Exchange Migration batch general statistics

Continuing with my previous post on useful details for providing migration status, I've written a script to output some important statistics for real time monitoring of Mailbox Migration batches.  The script takes a single parameter of 'BatchID' and will output direct to the PowerShell window.  

.\get-migrationstatsgeneral -BatchID "move16"

If the batch has any mailboxes that are still in a syncing state it will assume it is still in progress and output some related useful statistics.
How many total mailboxes in the batch, the total data size of the migration batch, total data already transferred, percentage of data completed, count of mailboxes synced or completed, count of mailboxes still being migrated, and data left to migrate.

Example output:

Migration batch "move16" contains a total of 200 mailboxes being migrated.
The total data size of the migration batch is estimated to be at least 140.38 GB.
139.42 GB have been processed thus far, accounting for 99 percent of the data to be transferred.
195 Mailboxes have been successfully Synced or Completed
2 mailboxes are still being moved, with an estimated 0.97 GB left to process


If the batch no longer contains mailboxes being synced, it will assume the batch has completed and output basic overall post migration statistics.
The total data size, count of mailboxes in failed state, and count of mailboxes in synced state requiring finalization.

Example output:

Migration batch "move16" has completed or fully synced.
The total data size of the migration batch was 141.09 GB
3 mailboxes failed to successfully be migrated.
197 mailboxes are in a Synced state and need to be finalized.


This information can be very useful for monitoring Migration progress real time without having to rerun multiple commands manually.


You can find the code here on GitHub as well:
https://github.com/joefunk/PowerShell/blob/master/Get-migrationstatsgeneral.ps1