Getting details of the master page and Setting up Master Page using PowerShell in SharePoint 2013

Get the Master Page details:

$site = GetSPSite http://yourSiteUrl/

$web = $site.RootWeb

$web.CustomMasterUrl

//This will give the url of the custom master used.

$web.MasterUrl

//This will give the url of the master page used.

$web.AlternateCssUrl

//This will give url of the custom css used.

To change the master page using powershell use below script:

$site = GetSPSite http://yourSiteUrl/

$web = $site.RootWeb

$web.MasterUrl = “_catalogs/masterpage/MasterPages/seattle.master”

//put the relevant path where your master page is present

$web.update()

//This will update the new master page for the SharePoint site.

This entry was posted in Articles. Bookmark the permalink.

Leave a comment