My SharePoint Log

Setting Site Collection MasterPages PowerShell Way

#######################

   
 

############################

   
 

asnp *sharepoint*

   
 

$site = Get-SPSite http://ss11.manhattan.com

   
 

# Change master page in each site

foreach ($Web in $Site.AllWebs)

{

       
 

    $Web.MasterUrl = “/_catalogs/masterpage/zeus/wide-sidebar.master”

    $Web.CustomMasterUrl = “/_catalogs/masterpage/zeus/wide.master”

    $Web.Update()

    $Web.Dispose()

     
 

}

   
 

#############################

   
 

Set Mysites Masterpages

   
 

asnp *sharepoint*

   
 

$site = Get-SPSite http://ss13.manhattan.com/mysites

   
 

# Change master page in each site

foreach ($Web in $Site.AllWebs)

{

       
 

    $Web.MasterUrl = “/mysites/_catalogs/masterpage/zeus/MySites_Only.master”

    $Web.CustomMasterUrl = “/mysites/_catalogs/masterpage/zeus/MySites_Only.master”

    $Web.Update()

    $Web.Dispose()

     
 

}

   
 

   
 

####################