Question

I am trying to set a custom master page on SP 2013 team site (on-prem). All the samples I can find involves the publishing feature, so I am turning here for tips on how set custom master page for a team site using powershell.

Thanks

Was it helpful?

Solution

Firstly I agree with @Aveenav that you should look into the building wsp package, that will follow Sharepoint model, it will place the master page in layouts directory, push it if you connect servers etc. But if you really need to, you can place in the SP library, and call it from there (you can place in the layouts as well but you will have to keep that folder in sync when applying changes across directories, performance here is the key as /layouts is available faster) then set up the master page using this script:

$web = Get-SPWeb siteurl
$web.MasterUrl = "masterpagerelativeurl"
$web.Update()
$web.Dispose()

You have more examples at http://get-spscripts.com/2010/09/changing-master-page-on-sharepoint.html

OTHER TIPS

Try appending URL

/_layouts/changesitemasterpage.aspx

Instead of using PowerShell, create a WSP package and hookup and event receiver for the feature that sets the master page. That way you can apply same master page to sub sites.

Try:

{your site}/_layouts/15/ChangeSiteMasterPage.aspx

Amal's answer didn't have the 15 in it. I don't have enough rep to add a comment to his solution.

Licensed under: CC-BY-SA with attribution
Not affiliated with sharepoint.stackexchange
scroll top