{"id":81265,"date":"2017-01-09T00:01:25","date_gmt":"2017-01-09T08:01:25","guid":{"rendered":"https:\/\/blogs.technet.microsoft.com\/heyscriptingguy\/?p=81265"},"modified":"2019-02-18T09:10:15","modified_gmt":"2019-02-18T16:10:15","slug":"sharepoint-online-cmdlets-to-help-your-migration","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/scripting\/sharepoint-online-cmdlets-to-help-your-migration\/","title":{"rendered":"SharePoint Online cmdlets to help your migration"},"content":{"rendered":"<p><strong>Summary<\/strong>: Use these PowerShell cmdlets to migrate to SharePoint Online.<\/p>\n<p>Today\u2019s post is from Christopher Weaver, who is a Microsoft Premier Field Engineer (PFE) and focuses on SharePoint and Office 365 solutions for large enterprise Premier customers. He has been doing PowerShell and SharePoint with Microsoft for nine years. In his spare time, he enjoys backpacking, hiking, kite surfing, and spending time with his kids and dog. You can follow him on his blog at <a target=\"_blank\" href=\"https:\/\/blogs.technet.microsoft.com\/christwe\/\">https:\/\/blogs.technet.microsoft.com\/christwe\/<\/a>.<\/p>\n<p>As we prepare our SharePoint Online environment for migration, we will need to be able to manage site collections and the web templates that we use to create those site collections. First, let\u2019s look at cmdlets that are available in this category.<\/p>\n<p><code>Get-SPOWebTemplate<\/code> \u2013 Gets all site templates that are available or gets specific templates based on different parameters. In the example, we get the default team site web template.<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/1-HSG-010917.png\"><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/1-HSG-010917.png\" alt=\"Example of Get-SPOWebTemplate\" width=\"614\" height=\"140\" class=\"alignnone size-full wp-image-81256\" \/><\/a><\/p>\n<p style=\"padding-left: 60px\"><code>Get-SPOWebTemplate -Name STS#0<\/code><\/p>\n<p><code>Get-SPOSite<\/code> \u2013 Gets one or more site collections. You could then take that object and pass it to another cmdlet or use its members.<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/2-HSG-010917.png\"><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/2-HSG-010917.png\" alt=\"Example of Get-SPOSite\" width=\"770\" height=\"132\" class=\"alignnone size-full wp-image-81266\" \/><\/a><\/p>\n<p style=\"padding-left: 60px\"><code>Get-SPOSite https:\/\/mmr258720.sharepoint.com<\/code><\/p>\n<p><code>New-SPOSite<\/code> \u2013 Creates a new site collection. You can use its many parameters to set several properties automatically at creation time.<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/3-HSG-010917.png\"><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/3-HSG-010917-1024x45.png\" alt=\"Example of New-SPOSite\" width=\"1024\" height=\"45\" class=\"alignnone size-large wp-image-81276\" \/><\/a><\/p>\n<p style=\"padding-left: 60px\"><code>New-SPOSite -url https:\/\/mmr258720.sharepoint.com\/sites\/test1 -Owner admin@mmr258720.onmicrosoft.com -StorageQuota 26214400<\/code><\/p>\n<p><code>Remove-SPOSite<\/code> \u2013 Moves a site collection to the recycle bin to permanently delete the site collection. Before the site is permanently deleted, you need to run the Remove-SPODeletedSite command or wait approximately 90 days. During this period, the site collection will not count towards storage quotas.<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/4-HSG-010917.png\"><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/4-HSG-010917-1024x140.png\" alt=\"Example of Remove-SPOSite\" width=\"1024\" height=\"140\" class=\"alignnone size-large wp-image-81286\" \/><\/a><\/p>\n<p style=\"padding-left: 60px\"><code>Remove-SPOSite https:\/\/mmr258720.sharepoint.com\/sites\/test1<\/code><\/p>\n<p><code>Set-SPOSite<\/code> \u2013 Lets you set many different properties on an existing site collection.<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/5-HSG-010917.png\"><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/5-HSG-010917-1024x32.png\" alt=\"Example of Set-SPOSite\" width=\"1024\" height=\"32\" class=\"alignnone size-large wp-image-81296\" \/><\/a><\/p>\n<p style=\"padding-left: 60px\"><code>Set-SPOSite https:\/\/mmr258720.sharepoint.com\/sites\/mr -lockstate NoAccess<\/code><\/p>\n<p><code>Test-SPOSite<\/code> \u2013 Runs one or several different health rules, and then returns the results.<\/p>\n<p>This command <u>only<\/u> produces a report; it does not make changes to your site. After you have reviewed the report and are comfortable with the repairs, run the <code>Repair-SPOSite<\/code> cmdlet, which I describe below.<\/p>\n<p>The site health rules are:<\/p>\n<table border=\"1\">\n<tbody>\n<tr bgcolor=\"black\">\n<th><span style=\"color: white\">Rule name<\/span><\/th>\n<th><span style=\"color: white\">Rule ID<\/span><\/th>\n<\/tr>\n<tr bgcolor=\"beige\">\n<td>Conflicting Content Types<\/td>\n<td>befe203b-a8c0-48c2-b5f0-27c10f9e1622<\/td>\n<\/tr>\n<tr bgcolor=\"white\">\n<td>Customized Files<\/td>\n<td>cd839b0d-9707-4950-8fac-f306cb920f6c<\/td>\n<\/tr>\n<tr bgcolor=\"beige\">\n<td>Missing Galleries<\/td>\n<td>ee967197-ccbe-4c00-88e4-e6fab81145e1<\/td>\n<\/tr>\n<tr bgcolor=\"white\">\n<td>Missing Parent Content Types<\/td>\n<td>a9a6769f-7289-4b9f-ae7f-5db4b997d284<\/td>\n<\/tr>\n<tr bgcolor=\"beige\">\n<td>Missing Site Templates<\/td>\n<td>5258ccf5-e7d6-4df7-b8ae-12fcc0513ebd<\/td>\n<\/tr>\n<tr bgcolor=\"white\">\n<td>Unsupported Language Pack References<\/td>\n<td>99c946f7-5751-417c-89d3-b9c8bb2d1f66<\/td>\n<\/tr>\n<tr bgcolor=\"beige\">\n<td>Unsupported MUI References<\/td>\n<td>6da06aab-c539-4e0d-b111-b1da4408859a<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>&nbsp;<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/6-HSG-010917.png\"><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/6-HSG-010917-1024x376.png\" alt=\"Example of Test-SPOSite\" width=\"1024\" height=\"376\" class=\"alignnone size-large wp-image-81306\" \/><\/a><\/p>\n<p style=\"padding-left: 60px\"><code>Test-SPOSite https:\/\/mmr258720.sharepoint.com<\/code><\/p>\n<p><code>Repair-SPOSite<\/code> \u2013 Runs the health tests from the Test-SPOSite command and, when possible, automatically repairs issues. After the command finishes running, it provides a report that includes results.<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/7-HSG-010917.png\"><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/7-HSG-010917-1024x389.png\" alt=\"Example of Repair-SPOSite\" width=\"1024\" height=\"389\" class=\"alignnone size-large wp-image-81315\" \/><\/a><\/p>\n<p style=\"padding-left: 60px\"><code>Repair-SPOSite https:\/\/mmr258720.sharepoint.com<\/code><\/p>\n<p><code>Upgrade-SPOSite<\/code> \u2013 Performs site collection upgrade by default. This is a build-to-build upgrade. On occasion, it could become a version-to-version upgrade when you must run a health check in repair mode to ensure that a site collection can be upgraded.<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/8-HSG-010917.png\"><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/8-HSG-010917.png\" alt=\"Example of Upgrade-SPOSite\" width=\"877\" height=\"54\" class=\"alignnone size-full wp-image-81325\" \/><\/a><\/p>\n<p style=\"padding-left: 60px\"><code>Upgrade-SPOSite https:\/\/mmr258720.sharepoint.com<\/code><\/p>\n<p>As we prepare to migrate, we must create the new site collection to which you\u2019ll migrate. So, let\u2019s look at the cmdlets that make this possible. The first cmdlet is <code>New-SPOSite<\/code> because this command creates the site collection. Let\u2019s look at the available parameters.<\/p>\n<p style=\"padding-left: 30px\"><strong><\/strong><\/p>\n<ul>\n<li>Url \u2013 A required parameter that represents the URL for your site collection. Make sure that the managed path is valid for your tenant.<\/li>\n<li>Owner \u2013 A required parameter that represents the user name of the owner, and it must be a valid user account in your tenant. You cannot use groups or distribution lists. The owner receives Full Control of the site collection. This user should receive some high-level training to ensure that he doesn\u2019t do undesired damage.<\/li>\n<li>StorageQuota &#8211; A required parameter that represents the maximum size in MB that the site collection will grow. This cannot exceed the tenant maximum and includes items like the Recycle Bin.<\/li>\n<li>Template \u2013 Although this is an optional parameter, I recommend that you set it ahead of time.\u00a0 If you don\u2019t set it, the first person who hits the site collection with the correct permissions will get to pick the template for you. You can pick a valid template by running the <code>Get-SPOWebTemplate<\/code> cmdlet.<\/li>\n<li>CompatibilityLevel \u2013 Although this is an optional parameter, I recommend you set this ahead of time.<\/li>\n<\/ul>\n<p style=\"padding-left: 30px\"><strong>NOTE<\/strong>: If you have a site collection with the same URL in the Recycle Bin, this cmdlet will fail with an error that looks like this.<\/p>\n<p style=\"padding-left: 60px\">New-SPOSite : A site already exists at url https:\/\/tenant.sharepoint.com\/sites\/sitecollection<\/p>\n<p style=\"padding-left: 60px\">The solution is to restore from the Recycle Bin or permanently delete it.<\/p>\n<p>If you have been following my last few articles, you should now be able to connect to the SharePoint Online service, manage the tenant, and manage\/create site collections. The next step will be how to use the migration API. Watch for that next.<\/p>\n<p>I invite you to follow the Scripting Guys on <a target=\"_blank\" href=\"http:\/\/bit.ly\/scriptingguystwitter\">Twitter<\/a> and <a target=\"_blank\" href=\"http:\/\/bit.ly\/scriptingguysfacebook\">Facebook<\/a>. If you have any questions, send email to them at <a target=\"_blank\" href=\"mailto:scripter@microsoft.com\">scripter@microsoft.com<\/a>, or post your questions on the <a target=\"_blank\" href=\"http:\/\/bit.ly\/scriptingforum\">Official Scripting Guys Forum<\/a>.<\/p>\n<p><strong>Christopher Weaver<\/strong>\nPremier Field Engineer<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Summary: Use these PowerShell cmdlets to migrate to SharePoint Online. Today\u2019s post is from Christopher Weaver, who is a Microsoft Premier Field Engineer (PFE) and focuses on SharePoint and Office 365 solutions for large enterprise Premier customers. He has been doing PowerShell and SharePoint with Microsoft for nine years. In his spare time, he enjoys [&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":[568,685,641],"tags":[694,499,377],"class_list":["post-81265","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-hey-scripting-guy","category-scripting-techniques","category-windows-powershell","tag-christopher-weaver","tag-guestblogger","tag-powershell"],"acf":[],"blog_post_summary":"<p>Summary: Use these PowerShell cmdlets to migrate to SharePoint Online. Today\u2019s post is from Christopher Weaver, who is a Microsoft Premier Field Engineer (PFE) and focuses on SharePoint and Office 365 solutions for large enterprise Premier customers. He has been doing PowerShell and SharePoint with Microsoft for nine years. In his spare time, he enjoys [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/posts\/81265","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=81265"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/posts\/81265\/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=81265"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/categories?post=81265"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/tags?post=81265"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}