Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

I want a PowerShell script to find where Features are activated in a site collection and its sites/subsites

Like for example feature "Enterprise feature"

share|improve this question
add comment

1 Answer 1

You have to iterate through all sites/webs for specific web application and call this snippet:

$o.Features | ? { $_.DefinitionId -eq 'featureId' } | % { $_.Parent }

Where $o can be SPWebApplication, SPSite or SPWeb object

EDIT: fullscript

$url = "http://localhost"
$featureId = "00bfea71-a83e-497e-9ba0-7a5c597d0107"

$s = Get-SPSite $url

Function FindFeature($obj, $fId) 
{
  $obj.Features | ? { $_.DefinitionId -eq $fId } | % { $_.Parent.Url }

  $obj.AllWebs | % {

    $_.Features | ? { $_.DefinitionId -eq $featureId } | % { $_.Parent.Url }    
    if ($_.AllWebs.Count -gt 0) {
      FindFeature($_, $fId);
    }
  }
}

FindFeature $s $featureId
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.