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 } |
Want to talk?
Drop us a line. We are here to answer your questions 24*7.