Thursday, March 19, 2015

Powershell script to upgrade UI version and apply root web master page to all subsites

I have used this powershell script to upgrade UI version and apply the master page at root web of a site collection to all subsites

$siteUrl = "http://<Site URL>"

Start-SPAssignment -Global
$site = Get-SPSite "$siteUrl"
$topWeb = Get-SPWeb $site.Url
$topWeb.CustomMasterUrl = "/_catalogs/masterpage/My.master"
$topWeb.MasterUrl = "/_catalogs/masterpage/My.master"
$topWeb.Update()
$site | Get-SPWeb -limit all | ForEach-Object {$_.UIVersion = 4;$_.UIVersionConfigurationEnabled = 0;if (($_.WebTemplate -ne "SRCHCEN") -and ($_.WebTemplate -ne "SRCHCENTERLITE") -and ($_.WebTemplate -ne "SRCHCENTERFAST")) {$_.CustomMasterUrl = $topWeb.CustomMasterUrl;$_.AllProperties["__InheritsCustomMasterUrl"] = "True";$_.MasterUrl = $topWeb.MasterUrl;$_.AllProperties["__InheritsMasterUrl"] = "True";$_.AlternateCssUrl = $topWeb.AlternateCssUrl;$_.AllProperties["__InheritsAlternateCssUrl"] = "True";$_.Update();}}

Stop-SPAssignment -Global

No comments:

SSL Error - The connection for this site is not secure

 After cloning a git repo of dot net framework website and trying to run it all I could see was this error Turns out the fix was to simply e...