Using Windows PowerShell with Staged Migrations: Part 3
Summary: Use Windows PowerShell to obtain the status and statistics from staged migrations.
Note This is a five-part series that includes the following posts:
- Using Windows PowerShell with Staged Migrations: Part 1
Use Windows PowerShell to add and verify email domains in Office 365.
- Using Windows PowerShell with Staged Migrations: Part 2
Use Windows PowerShell to upload and start staged migrations.
- Using Windows PowerShell with Staged Migrations: Part 3
Use Windows PowerShell to obtain the status and statistics from staged migrations.
- Using Windows PowerShell with Staged Migrations: Part 4
Use Windows PowerShell to convert mailboxes to mail-enabled users in Office 365.
- Using Windows PowerShell with Staged Migrations: Part 5
Use Windows PowerShell to license users and correct the login ID for Office 365.
Honorary Scripting Guy, Sean Kearney, is here. Today we’re going to look into using Windows PowerShell on a deeper level with our staged migrations. That is, we’re going to pull down not only the results of said migrations, but also statistics.
When you examine your staged migrations you’ll see simple results such as Synched or Failed. In the following image, you can see the four batches we have done. All of these were successful.
If you click the name of a batch, you can see some deeper details, such as the number of mailboxes being migrated and the number that were successful.
There is also a View details link that can drill down even further into the status of the migrations, such as the time each one started, the amount of content in that migration, and when it ended:
The catch again is that navigating in the GUI can be slow. You might also want to mine the results so that you can give the client a report about how fast the transfers are occurring or the percentage of failures.
All of this data is naturally accessible by using Windows PowerShell—which means for you, all of this data is only a cmdlet or two away.
The simplest pieces are actually attached to the cmdlet that showed us the list, which was Get-MigrationBatch. When I run this through Get-Member, I find some interesting and useful properties that we can access regarding the statistics of the migrations:
The DateTime properties are quite obvious, which means we can readily look at a migration batch with Windows PowerShell and access the Date and Time it started and completed. But there are some extra interesting properties such as Reports, ValidationWarnings, and ValidationWarningCount.
Validation warnings include information such as an email address not found or possibly a formatting error in the data in the CSV file you uploaded. Here is an example of using ValidationWarningCount for a series of batches from Windows Powershell:
We can see that for the batch called hsg-batch-4, there is a validation warning. We can access some deeper details about the validation warning by executing Get-MigrationBatch and directly targeting that batch:
(Get-MigrationBatch –identity hsg-batch-4).validationwarnings
There are some additional cmdlets to pull down further details about the migrations that you’ll want.
Get-MigrationUser shows the basic stats of all users that have been migrated and the names of the migration batches they were attached to:
Get-MigrationUserStatistics gets even deeper details of those migrations. Running it against Get-Member yields a plethora of information about the migrations you have performed:
Get-MigrationUser | Get-MigrationUserStatistics | Get-Member
Following are some interesting and very useful properties that we can access to show us what we’ve transferred and how long it took:
What this means to you and me is that we can pull out the data and statistics needed for our client migration reports. We can quite easily determine the overall transfer time and use these statistics to determine the average amount of time and bandwidth for future migrations.
Our next task is to convert the Exchange mailboxes to mail-enabled users in Office 365. Stay tuned for more Windows PowerShell goodies tomorrow!
I invite you to follow The Scripting Guys on Twitter and Facebook. If you have any questions, send an email to The Scripting Guys at firstname.lastname@example.org or post your questions on the Official Scripting Guys Forum. See you tomorrow. Until then remember eat your cmdlets every day with a taste of creativity.
Sean Kearney, Windows PowerShell MVP and Honorary Scripting Guy