http://www.toddklindt.com/blog/Lists/Posts/Post.aspx?ID=226
The master page setting is scoped at the web level, so the first thing I did was use Get-SPWeb to get a variable for the web I want to change. There are two properties that control the master page settings; MasterUrl and CustomMasterUrl. The former controls the master page used to render the System pages (the ones that start with /_layouts) and the latter controls the master page used to render the content pages.
To alter those settings for a publishing site at http://sharepoint/, use the following PowerShell script:
$web = Get-SPWeb http://sharepointurl/
$web.CustomMasterUrl = "/_catalogs/masterpage/customMasterPage.master"
$web.MasterUrl = "/_catalogs/masterpage/customMasterPage.master"
$web.Update()
This changes the master page for both settings and content to a customMasterPage.master. You can also set it to the default v4.master if you just need to reset it to the default masterpage. Since we're doing this with PowerShell it's easy to loop through a group of webs and set their master pages to whatever you like
No comments:
Post a Comment