Search This Blog

Sunday, September 1, 2013

Change the SharePoint Master Pages for Publishing Site and Non-Publishing Sites?


 My default master (V4.master)page in SharePoint 2010

V4.master


Nowchanging from V4 master page to custom master page using below command in power shell.

$site = Get-SPSite http://Site URL/
foreach ($web in $site.AllWebs) {
$web; $web.CustomMasterUrl = "/_catalogs/masterpage/custom.master"; 
$web.Update(); $web.CustomMasterUrl;
$web.Dispose()
}
foreach ($web in $site.AllWebs) {
$web; $web.MasterUrl = "/_catalogs/masterpage/custom.master"; 
$web.Update(); $web.MasterUrl;
$web.Dispose()
}
$site.Dispose()
write-host "Complete! Custom.master is now applied";





After execute this command,the result will be like this...

custom.master
Happy scripting...

No comments:

Post a Comment