Freitag, 20. Januar 2012

Powershell script how to change the master-page

If you want to change your master-page in your whole site-collection with all sub-sites, then you can use this powershell-script to manage this quite easily (change the %%-values according to your settings or needs):

$site = Get-SPSite -Identity "%url of the site%"
foreach($subsite in $site.AllWebs)
{
$subsite.AllowUnsafeUpdates = "True"
$subsite.CustomMasterUrl = "/_catalogs/masterpage/%my master-page%.master"
$subsite.Update()
$subsite.Dispose()
}

Keine Kommentare:

Kommentar veröffentlichen