Friday, September 13, 2013

Get SharePoint Feature by Name and Execute for all site collections

This is a simple script for day today works :)

This script will find a feature that contains name like “OpenIn” and activate for entire site collections.

Enable Feature for All Site Collections

$feature = Get-SPFeature | where { $_.DisplayName -like "*OpenIn*" }
 
$featureId = $feature.Id
Get-SPSite -limit ALL |foreach{ Enable-SPFeature $featureId  -url $_.URL -confirm:$false }

This script will find a feature that contains name like “OpenIn” and deactivate for entire site collections.


Disable Feature for All Site Collections



$feature = Get-SPFeature | where { $_.DisplayName -like "*OpenIn*" }
 
$featureId = $feature.Id
Get-SPSite -limit ALL |foreach{ Disable-SPFeature $featureId  -url $_.URL -confirm:$false }
Post a Comment