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:

c# httpclient The remote certificate is invalid according to the validation procedure: RemoteCertificateNameMismatch

 If we get this error while trying to get http reponse using HttpClient object, it could mean that certificate validation fails for the remo...