powershell - Change master page for all sites -


i have new master has applied on of sites. don't know change content of odler master page in database (for sites) via powershell. know how iterate sites , modify url of master page, me want change content of master page.

thanks help

this should work. adds farm master page.

foreach($webapp in (get-spwebapplication))   foreach($site in $webapp.sites)    # check compatibility level -> 14 if sp2010, 15 if sp2013   if ($site.compatibilitylevel –eq 15)      foreach ($web in $site.allwebs)       if ($web.exists)         $web.sitelogourl = "/siteassets/logo.png"         $web.sitelogodescription = "my powershell site"         $web.masterurl = "/_catalogs/masterpages/seattle.master"         $web.custommasterurl = "/_catalogs/masterpages/seattle.master"  $web.update()  $web.dispose() $site.dispose() 

Comments