SharePoint Migration from SharePoint 2010 to 2013- Visual Upgrade. PowerShell script to perform Visual upgrade / Site collection version upgrade

PowerShell script to upgrade migrated SharePoint 2010 site collections to SharePoint 2013
PowerShell script to upgrade migrated SharePoint 2010 site collections to SharePoint 2013

Hi All,

Greetings for the day ๐Ÿ™‚ LIFE IS BEAUTIFUL ๐Ÿ™‚

Since from some time working migration projects sharing all details – PowerShell script implementing, issues and respective solution.

Today sharing the PowerShell scripts to upgrade the UI version of site collections after mount db successful

Background / Details :

  • SharePoint migration going on. We have migrated our SharePoint 2010 application to SharePoint 2013 application
  • Databases are mounted to our new SharePoint 2013 web application
  • Sites are opening properly in SharePoint 2010 UI
  • Next step is to Visually upgrade all Site Collections so that they have SharePoint 2013 UI
  • Since we have huge number of site collections, PowerShell our friend ๐Ÿ™‚
  • So written the PowerShell script and sharing :

Step by step PowerShell script to upgrade site collections from SharePoint 2010 to SharePoint 2013 (Visual upgrade) :

#Add Microsoft SharePoint snap-in to the current session of PowerShell  
Add-PsSnapin Microsoft.SharePoint.PowerShell

  • Use Start-SPAssignment CMDLET :
    • Large amounts of memory are required when we use objects like SPWeb, SPSite, or SPSiteAdminsitration
    • So the use of these objects, or lists of these objects, in Windows PowerShell scripts requires memory management
    • By default, all Get commands dispose of these objects immediately after the pipeline finishes, but by using SPAssignment, we can assign the list of objects to a variable and dispose of the objects after they are no longer needed
    • You can also ensure that the objects remain as long as you need them, even throughout multiple iterations of commands
#The Start-SPAssignment cmdlet properly disposes of objects used with variable #assignments
Start-SPAssignment -Global
  • Get our new SharePoint 2013 web application of which we need to upgrade all sites
#get the web application of which we need to visually upgrade the sites
$webApp = Get-SPWebApplication "<My WebApplication>"

  • Get all sites from the respective web application
#Get all sites
$sites = $webApp.Sites
  • Upgrade every site collection using Upgrade-SPSite
foreach($site in $sites){
 
try {

      Add-Content "D:\PS\vsupgradelogs.txt" "Upgrading site - " $site.Url

      Upgrade-SPSite -Identity $site.Url -VersionUpgrade

    }catch{

      Add-Content "D:\PS\vsupgradeerrorlogs.txt" "Error while upgrading site - 
      " $_.Exception.Message
   }
}#foreach($site in $sites)

Complete Script :

#Add Microsoft SharePoint snap-in to the current session of PowerShell  
Add-PsSnapin Microsoft.SharePoint.PowerShell

#The Start-SPAssignment cmdlet properly disposes of objects used with variable #assignments
Start-SPAssignment -Global

#get the web application of which we need to visually upgrade the sites
$webApp = Get-SPWebApplication "<My WebApplication>"

#Get all sites
$sites = $webApp.Sites

foreach($site in $sites){
 try {
      Add-Content "D:\PS\vsupgradelogs.txt" "Upgrading site - " $site.Url

      Upgrade-SPSite -Identity $site.Url -VersionUpgrade

    }catch{

      Add-Content "D:\PS\vsupgradeerrorlogs.txt" "Error while upgrading site - 
      " $_.Exception.Message
   }
}#foreach($site in $sites)

Thanks for reading ๐Ÿ™‚ If its worth at least reading once, kindly please like and share ๐Ÿ™‚ SHARING IS CARING ๐Ÿ™‚

Enjoy the beautiful life ๐Ÿ™‚ Have a FUN ๐Ÿ™‚ HAVE A SAFE LIFE ๐Ÿ™‚ TAKE CARE ๐Ÿ™‚

Prasham Sabadra

LIFE IS VERY BEAUTIFUL :) ENJOY THE WHOLE JOURNEY :) Founder of Knowledge Junction and live-beautiful-life.com, Author, Learner, Passionate Techie, avid reader. Certified Professional Workshop Facilitator / Public Speaker. Scrum Foundation Professional certificated. Motivational, Behavioral , Technical speaker. Speaks in various events including SharePoint Saturdays, Boot camps, Collages / Schools, local chapter. Can reach me for Microsoft 365, Azure, DevOps, SharePoint, Teams, Power Platform, JavaScript.

You may also like...

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: