Smoothly activating a Feature across SharePoint Site Collections Smoothly activating a Feature across SharePoint Site Collections
Keyur Nathani

Keyur Nathani

November 27, 2013

All Post
img
Share:

It’s useful to be able to activate features across site collections. This two line script grabs the desired feature, then grabs the collection of Site Collections and pipes them into a Feature Activation CmdLet masking errors; errors occur such as when activating a feature that is already activated.

$defaultOpenBehaviorFeatureId = $(Get-SPFeature -limit all | where {$_.displayname -eq "OpenInClient"}).Id
Get-SPSite -limit ALL | foreach { enable-SPFeature $defaultOpenBehaviorFeatureId -url $_.URL -ErrorAction SilentlyContinue }

This is with a sample filter:

$defaultOpenBehaviorFeatureId = $(Get-SPFeature -limit all | where {$_.displayname -eq "OpenInClient"}).Id
Get-SPSite  -limit all | where {$_.url -like "ht tp://SharePoint dev/ThisPath/*"}  | foreach { enable-SPFeature $defaultOpenBehaviorFeatureId -url $_.URL -ErrorAction SilentlyContinue }

Leave a Reply

Your email address will not be published. Required fields are marked *

Want to talk?

Drop us a line. We are here to answer your questions 24*7.