Get useful output from Get-MigrationBatch

No matter if you are doing an on-premises migration or a move to Office 365 – when you issue a PowerShell command you expect useful output. So when you execute the following command:

Get-MigrationBatch

You see the following result:

Get-MigrationBatch1

What the…. useful? Where’s the information about the failure rate, etc etc etc? Especially because the ECP shows us this information? What did the developers of this cmdLet think (or not think) an administrator wants to know?

So let’s pimp this command by using simple PowerShell cmdLets.

Get-MigrationBatch | select identity,Status,TotalCount,SyncedCount,FinalizedCount,FailedCount,Notificationemails | Format-Table

And now the output is much more helpful than before:

Get-MigrationBatch2

If you are a PowerShell beginner and ask yourself now: “How can I find the exact names of the fields I am looking for?” Well here is the answer: execute this command and search for the parameters you need and start building your own output:

(Get-MigrationBatch)[0] | select *

This shows you all attributes of the first (and so also of all other) migration batches. If you have only one batch, you can simplify it a little bit:

Get-MigrationBatch | select *

If you plan to exercise more with Mirgation Batches a good point to start is the Technet help for Get-MigrationBatch

Published by Andreas

Founder of M365 Evangelists Cloud-Architect, Strategy Consultant, Consultant for Microsoft technologies, Graph API enthusiast, PowerShell enthusiast