2

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"

2 Answers 2

2

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: https://technet.microsoft.com/en-us/library/ff607945.aspx

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.