I have a new master which has to be applied on all of my sites. But I don't know to change the content of my odler master page in database (for all sites) via Powershell. I know how iterate my sites and modify the url of the master page, but me I just want to change the CONTENT of my master page.
Thanks for your help
This should work. This adds to all Farm your 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()