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"

1

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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