Enable The SharePoint Learning Kit Feature On All Sites In A Site Collection

Sometimes you want to be able to assign work from anywhere within your site collection. For the E-Learning Actions custom action to be added to a document library you need to enable the SharePoint Learning Kit feature on that site, so to enable it everywhere you need to enable the feature on all sites.

To do this in SharePoint 2010 all you need is a simple PowerShell script which iterates through all the sites and then enables the feature if it is not already enabled. The following script will do that for you. You will need to change the url value to reference your site collection, save in a .ps1 file and then run from the SharePoint 2010 Management Shell.

$url = "http://urlOfSiteCollection"  $site = Get-SPSite $url  $featureId = "00057002-c978-11da-ba52-00042350e42e"  $featureName = "SharePointLearningKit"  $site.Urlforeach ($web in $site.AllWebs)  {      # Output the site url for debugging purposes      $web.Url      # Only enable if not already enabled      if (!$web.Features[$featureId])      {          # Output debugging message          "Enabling..."          Enable-SPFeature $featureName -Url $web.Url      }  }

You can also use this for other features, just by replacing the feature id and name with the appropriate values. To find these look in

C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\TEMPLATE\FEATURES

The feature name is the name of the folder in here and the id is in the feature.xml file in that folder.