SharePoint Migration from SharePoint 2010 to 2013- Visual Upgrade. PowerShell script to perform Visual upgrade / Site collection version upgrade
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. Otherwise for SharePoint CMDLET we get an error as discussed in last article – PowerShell ISE – resolving issue – Get-SPWebApplication : The term ‘Get-SPWebApplication’ is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again. Bit about Add-PSSnapin
#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 🙂