How to find out which masterpage is in use in SharePoint 2010 / 2013

If your SharePoint site doesn’t have the Publishing Feature activated you will not have access to the “Master Page” option in the Site Settings page.

If you try to navigate to that page through the page address /_Layouts/ChangeSiteMasterPage.aspx you might see a blank page (if the site collection of your site has the publishing feature activated then you’ll be able to navigate to this URL and all your problems are solved).

PowerShell

With the help of PowerShell you can not only see the current definitions for the site masterpage, system masterpage and alternate CSS file, but you can also change these values through the console.

To check the settings you can use this code in the server’s PowerShell console:

Add-PSSnapin Microsoft.SharePoint.PowerShell
$site = Get-SPSite http://test.sp2010.dev
$web = $site.RootWeb
$web.CustomMasterUrl
$web.MasterUrl
$web.AlternateCssUrl

If you want the settings for an SPWeb that’s not the root web you can get that SPWeb using its name:

$web = $site.AllWebs["Name of the site"]

Now, to update these settings you will use the same properties and give them a value, and don’t forget to use the Update() method when you’re done. Let’s see an example of this (the $web object is already defined as in the previous example):

$web.AlternateCssUrl = "/_layouts/mystyles.css"
$web.Update()

This is the update in action:

Dércia Silva
Posted by Dércia Silva on October 3, 2013

Related articles