SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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
up vote 0 down vote accepted

This might also help someone:

Get-SPSite -Limit All| Where-Object {(Get-SPFeature "PublishingSite" -ErrorAction SilentlyContinue -Site $_.Url) -ne $null } | Select Url

Taken from this blog post. See full reference:

share|improve this answer

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

Your Answer


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.