I’ve got a challenge to make visual upgrade on our test environment and implement new branding feature on all its sites.
For this I created this script.
$WebApp = Get-SPWebApplication http://new-intranet
foreach ($Site in $WebApp.sites)
{
$Site.VisualUpgradeWebs()
Enable-SPFeature “CustomStyle” -Url $Site.Url -confirm:$false
}
P.S. This Script should be run using account which has permissions to SharePoint Config, Central Admin and Content Databases and run on SharePoint Web Server.