{"id":5361,"date":"2015-06-24T00:01:00","date_gmt":"2015-06-24T00:01:00","guid":{"rendered":"https:\/\/blogs.technet.microsoft.com\/heyscriptingguy\/2015\/06\/24\/using-windows-powershell-with-staged-migrations-part-3\/"},"modified":"2019-02-18T09:47:19","modified_gmt":"2019-02-18T16:47:19","slug":"using-windows-powershell-with-staged-migrations-part-3","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/scripting\/using-windows-powershell-with-staged-migrations-part-3\/","title":{"rendered":"Using Windows PowerShell with Staged Migrations: Part 3"},"content":{"rendered":"<p><b style=\"font-size:12px\">Summary: <\/b><span style=\"font-size:12px\">Use Windows PowerShell to obtain the status and statistics from staged migrations.<\/span><\/p>\n<p><span style=\"font-size:12px\"><\/span><\/p>\n<p><b>Note<\/b>&nbsp;&nbsp;This is a five-part series that includes the following posts:<\/p>\n<p><span style=\"font-size:12px\"><\/span><\/p>\n<ul>\n<li><a href=\"\/b\/heyscriptingguy\/archive\/2015\/06\/22\/using-windows-powershell-with-staged-migrations-part-1.aspx\">Using Windows PowerShell with Staged Migrations: Part 1<\/a> <br \/> Use Windows PowerShell to add and verify email domains in Office 365.<\/li>\n<li><a href=\"\/b\/heyscriptingguy\/archive\/2015\/06\/23\/using-windows-powershell-with-staged-migrations-part-2.aspx\">Using Windows PowerShell with Staged Migrations: Part 2<\/a> <br \/> Use Windows PowerShell to upload and start staged migrations.<\/li>\n<li><a href=\"\/b\/heyscriptingguy\/archive\/2015\/06\/24\/using-windows-powershell-with-staged-migrations-part-3.aspx\">Using Windows PowerShell with Staged Migrations: Part 3<\/a> <br \/> Use Windows PowerShell to obtain the status and statistics from staged migrations.<\/li>\n<li><a href=\"\/b\/heyscriptingguy\/archive\/2015\/06\/25\/using-windows-powershell-with-staged-migrations-part-4.aspx\">Using Windows PowerShell with Staged Migrations: Part 4<\/a> <br \/> Use Windows PowerShell to convert mailboxes to mail-enabled users in Office 365.<\/li>\n<li><a href=\"\/b\/heyscriptingguy\/archive\/2015\/06\/26\/using-windows-powershell-with-staged-migrations-part-5.aspx\">Using Windows PowerShell with Staged Migrations: Part 5<\/a> <br \/> Use Windows PowerShell to license users and correct the login ID for Office 365.&nbsp;<\/li>\n<\/ul>\n<p><span style=\"font-size:12px\">Honorary Scripting Guy, Sean Kearney, is here.&nbsp;<\/span><span style=\"font-size:12px\">Today we&rsquo;re going to look into using Windows PowerShell on a deeper level with our staged migrations. That is, we&rsquo;re going to pull down not only the results of said migrations, but also statistics.<\/span><\/p>\n<p>When you examine your staged migrations you&rsquo;ll see simple results such as <b>Synched<\/b> or <b>Failed<\/b>. In the following image, you can see the four batches we have done. All of these were successful.<\/p>\n<p><a href=\"https:\/\/msdnshared.blob.core.windows.net\/media\/TNBlogsFS\/prod.evol.blogs.technet.com\/CommunityServer.Blogs.Components.WeblogFiles\/00\/00\/00\/76\/18\/3187.1.PNG\"><img decoding=\"async\" src=\"https:\/\/msdnshared.blob.core.windows.net\/media\/TNBlogsFS\/prod.evol.blogs.technet.com\/CommunityServer.Blogs.Components.WeblogFiles\/00\/00\/00\/76\/18\/3187.1.PNG\" alt=\"Image of menu\" title=\"Image of menu\" \/><\/a><\/p>\n<p>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.<\/p>\n<p><a href=\"https:\/\/msdnshared.blob.core.windows.net\/media\/TNBlogsFS\/prod.evol.blogs.technet.com\/CommunityServer.Blogs.Components.WeblogFiles\/00\/00\/00\/76\/18\/6131.2.PNG\"><img decoding=\"async\" src=\"https:\/\/msdnshared.blob.core.windows.net\/media\/TNBlogsFS\/prod.evol.blogs.technet.com\/CommunityServer.Blogs.Components.WeblogFiles\/00\/00\/00\/76\/18\/6131.2.PNG\" alt=\"Image of menu\" title=\"Image of menu\" \/><\/a><\/p>\n<p>There is also a <b>View details<\/b> 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:<\/p>\n<p><a href=\"https:\/\/msdnshared.blob.core.windows.net\/media\/TNBlogsFS\/prod.evol.blogs.technet.com\/CommunityServer.Blogs.Components.WeblogFiles\/00\/00\/00\/76\/18\/8468.3.PNG\"><img decoding=\"async\" src=\"https:\/\/msdnshared.blob.core.windows.net\/media\/TNBlogsFS\/prod.evol.blogs.technet.com\/CommunityServer.Blogs.Components.WeblogFiles\/00\/00\/00\/76\/18\/8468.3.PNG\" alt=\"Image of menu\" title=\"Image of menu\" \/><\/a><\/p>\n<p>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.<\/p>\n<p>All of this data is naturally accessible by using Windows PowerShell&mdash;which means for you, all of this data is only a cmdlet or two away.<\/p>\n<p>The simplest pieces are actually attached to the cmdlet that showed us the list, which was <b>Get-MigrationBatch<\/b>. When I run this through <b>Get-Member<\/b>, I find some interesting and useful properties that we can access regarding the statistics of the migrations:<\/p>\n<ul>\n<li>Identity<\/li>\n<li>Status<\/li>\n<li>TotalCount<\/li>\n<li>SyncedCount<\/li>\n<li>FailedCount<\/li>\n<li>ProvisionedCount<\/li>\n<li>ValidationWarningsCount<\/li>\n<li>ValidationWarnings<\/li>\n<li>CreationDateTime<\/li>\n<li>StartDateTime<\/li>\n<li>InitialSyncDateTime<\/li>\n<li>InitialSyncDateDuration<\/li>\n<li>LastSyncedDateTime<\/li>\n<li>Reports<\/li>\n<\/ul>\n<p>The <b>DateTime<\/b> 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 <b>Reports<\/b>, <b>ValidationWarnings<\/b>, and <b>ValidationWarningCount<\/b>.<\/p>\n<p>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 <b>ValidationWarningCount<\/b> for a series of batches from Windows Powershell:<\/p>\n<p><a href=\"https:\/\/msdnshared.blob.core.windows.net\/media\/TNBlogsFS\/prod.evol.blogs.technet.com\/CommunityServer.Blogs.Components.WeblogFiles\/00\/00\/00\/76\/18\/5277.4.PNG\"><img decoding=\"async\" src=\"https:\/\/msdnshared.blob.core.windows.net\/media\/TNBlogsFS\/prod.evol.blogs.technet.com\/CommunityServer.Blogs.Components.WeblogFiles\/00\/00\/00\/76\/18\/5277.4.PNG\" alt=\"Image of command output\" title=\"Image of command output\" \/><\/a><\/p>\n<p>We can see that for the batch called <b>hsg-batch-4<\/b>, there is a validation warning. We can access some deeper details about the validation warning by executing <b>Get-MigrationBatch<\/b> and directly targeting that batch:<\/p>\n<p style=\"margin-left:30px\">(Get-MigrationBatch &ndash;identity hsg-batch-4).validationwarnings<\/p>\n<p><a href=\"https:\/\/msdnshared.blob.core.windows.net\/media\/TNBlogsFS\/prod.evol.blogs.technet.com\/CommunityServer.Blogs.Components.WeblogFiles\/00\/00\/00\/76\/18\/4276.5.PNG\"><img decoding=\"async\" src=\"https:\/\/msdnshared.blob.core.windows.net\/media\/TNBlogsFS\/prod.evol.blogs.technet.com\/CommunityServer.Blogs.Components.WeblogFiles\/00\/00\/00\/76\/18\/4276.5.PNG\" alt=\"Image of command output\" title=\"Image of command output\" \/><\/a><\/p>\n<p>There are some additional cmdlets to pull down further details about the migrations that you&rsquo;ll want.<\/p>\n<p><b>Get-MigrationUser <\/b>shows the basic stats of all users that have been migrated and the names of the migration batches they were attached to:<\/p>\n<p><a href=\"https:\/\/msdnshared.blob.core.windows.net\/media\/TNBlogsFS\/prod.evol.blogs.technet.com\/CommunityServer.Blogs.Components.WeblogFiles\/00\/00\/00\/76\/18\/4024.6.PNG\"><img decoding=\"async\" src=\"https:\/\/msdnshared.blob.core.windows.net\/media\/TNBlogsFS\/prod.evol.blogs.technet.com\/CommunityServer.Blogs.Components.WeblogFiles\/00\/00\/00\/76\/18\/4024.6.PNG\" alt=\"Image of command output\" title=\"Image of command output\" \/><\/a><\/p>\n<p><b>Get-MigrationUserStatistics<\/b> gets even deeper details of those migrations. Running it against <b>Get-Member<\/b> yields a plethora of information about the migrations you have performed:<\/p>\n<p style=\"margin-left:30px\">Get-MigrationUser | Get-MigrationUserStatistics | Get-Member<\/p>\n<p><a href=\"https:\/\/msdnshared.blob.core.windows.net\/media\/TNBlogsFS\/prod.evol.blogs.technet.com\/CommunityServer.Blogs.Components.WeblogFiles\/00\/00\/00\/76\/18\/2746.7.PNG\"><img decoding=\"async\" src=\"https:\/\/msdnshared.blob.core.windows.net\/media\/TNBlogsFS\/prod.evol.blogs.technet.com\/CommunityServer.Blogs.Components.WeblogFiles\/00\/00\/00\/76\/18\/2746.7.PNG\" alt=\"Image of command output\" title=\"Image of command output\" \/><\/a><\/p>\n<p>Following are some interesting and very useful properties that we can access to show us what we&rsquo;ve transferred and how long it took:<\/p>\n<ul>\n<li>SyncedItemCount<\/li>\n<li>TotalInprogressDuration<\/li>\n<li>BytesTransferred<\/li>\n<li>AverageBytesTransferredPerHour<\/li>\n<\/ul>\n<p>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.<\/p>\n<p>Our next task is to convert the Exchange mailboxes to mail-enabled users in Office 365. Stay tuned for more Windows PowerShell goodies tomorrow!<\/p>\n<p>I invite you to follow The Scripting Guys on <a href=\"http:\/\/bit.ly\/scriptingguystwitter\" target=\"_blank\">Twitter<\/a> and <a href=\"http:\/\/bit.ly\/scriptingguysfacebook\" target=\"_blank\">Facebook<\/a>. If you have any questions, send an email to The Scripting Guys at <a href=\"mailto:scripter@microsoft.com\" target=\"_blank\">scripter@microsoft.com<\/a> or post your questions on the <a href=\"http:\/\/bit.ly\/scriptingforum\" target=\"_blank\">Official Scripting Guys Forum<\/a>. See you tomorrow. Until then remember eat your cmdlets every day with a taste of creativity.<\/p>\n<p><b>Sean Kearney, <\/b>Windows PowerShell MVP and Honorary Scripting Guy<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Summary: Use Windows PowerShell to obtain the status and statistics from staged migrations. Note&nbsp;&nbsp;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 [&hellip;]<\/p>\n","protected":false},"author":596,"featured_media":87096,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[1],"tags":[],"class_list":["post-5361","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-scripting"],"acf":[],"blog_post_summary":"<p>Summary: Use Windows PowerShell to obtain the status and statistics from staged migrations. Note&nbsp;&nbsp;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 [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/posts\/5361","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/users\/596"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/comments?post=5361"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/posts\/5361\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/media\/87096"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/media?parent=5361"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/categories?post=5361"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/tags?post=5361"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}