Apply Custom Master Page To Site using Power Shell

function ApplyMasterPageToSearchSite([string] $siteURL, [string] $SiteName)

        $subsiteurl = $siteURL + "/" + $SiteName + "/default.aspx"

        Enable-SPFeature -identity "94c94ca6-b32f-4da9-a9e3-1f3d343d7ecb" -url $subsiteurl

        Start-SPAssignment -Global
        $site = Get-SPSite $siteURL
        Write-Host "Get the Site" -foregroundcolor green
        $topWeb = Get-SPWeb $site.Url

        Write-Host "Update Master Page to search" -foregroundcolor green
        $site | Get-SPWeb -limit all | ForEach-Object { $_.MasterUrl = "/_catalogs/masterpage/LMSSearchMaster.master";$_.Update() }

        Write-Host "Master Page assigned" -foregroundcolor green
        Stop-SPAssignment -Global


Popular posts from this blog

Custom Form Base Login Web Part With Sharepoint 2010

Real World Branding with SharePoint 2010 Publishing Sites