Using PowerShell to apply master page and logo settings to all sites in a farm

For this recipe, we are using a PowerShell script to apply master page and logo settings to each SharePoint site in every site collection of each web application on the local SharePoint farm.

How to do it...

Follow these steps to apply master page and logo settings to all sites in the local SharePoint farm using PowerShell:

  1. Open your preferred text editor to create the .ps1 script file.
  2. Use a foreach loop to iterate through each content of SPWebApplication on the local SharePoint farm using the Get-SPWebApplication Cmdlet:
    foreach($webApp in (Get-SPWebApplication))
    
  3. Use a foreach loop to iterate through each SPSite in the Sites property of the SPWebApplication object:

Get SharePoint 2013 WCM Advanced Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.