Activating the site collection feature on all site collections with PowerShell

With our custom branding solution deployed to the SharePoint farm, we need to activate the site collection feature. The simplest method to activate the site collection feature on all site collections is using PowerShell.

How to do it...

Follow these steps to activate the feature on each site collection in the farm:

  1. Assign the SiteCollectionBranding feature ID to a PowerShell variable, using the following command:
    $brandingFeatureId = [GUID]"19e46226-efb9-4761-b09a-cb8711fd503a"
    
  2. Use the Get-SPWebApplication Cmdlet to get the content web applications and iterate through them as follows:
    foreach ($webApp in (Get-SPWebApplication))
  3. Iterate through each site collection in the ...

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.