Book Image

SharePoint 2013 WCM Advanced Cookbook

By : JOHN CHAPMAN
Book Image

SharePoint 2013 WCM Advanced Cookbook

By: JOHN CHAPMAN

Overview of this book

Table of Contents (19 chapters)
SharePoint 2013 WCM Advanced Cookbook
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

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 web application using the following code:

    foreach ($site in $webApp.Sites)
  4. Ensure the site collection is in 2013 mode.

    if ($site.CompatibilityLevel –eq 15)
  5. Verify that the SiteCollectionBranding feature is in the collection of activated features on the...