SharePoint 2013: Perform a Visual Upgrade using PowerShell

Scenario

You want to upgrade the functionality for all webs in a site collection to version 15 (SharePoint 2013) after a migration from a previous version of SharePoint. 

Solution

You can use the following PowerShell to iterate through all the webs in a site collection, setting the UIVersion property to 15 (enabling the SharePoint 2013 features).

$SiteCollection = Get-SPsite "http://sitecollection"            
foreach($SPWeb in $SiteCollection.AllWebs)            
{            
    $SPWeb.AllowUnsafeUpdates = $true;            
    Write-Host $SPWeb.UIVersion;            
    $SPWeb.UIVersion = 15;            
    $SPWeb.UIversionConfigurationEnabled=$true;            
    $SPWeb.update();            
    Write-Host $SPWeb.UIVersion;            
    $SPWeb.AllowUnsafeUpdates = $false;            
    $SPWeb.Dispose();            
}

See Also

Other Languages

This article is also available in the following languages: