PowerShell Script To Find Where SharePoint 2010 Features Are Activated

Reading Time: 2 minutes

   The script on this post will find where features are activated within your SharePoint 2010 farm.



   Over the past few months I’ve gotten literally dozens of emails, blog comments, or personal requests from people asking “how do I find where a SharePoint feature has been activated?”  I wrote a script to find which features are installed on your farm almost 3 years ago.  There is also the Get-SPFeature PowerShell commandlet in SharePoint 2010.  The problem is that these only tell you if a feature is installed not where they have been activated.  This is especially important to know if you have multiple web applications, site collections, and /or sites.


   The default call (no parameters) for Get-SPFeature will return all features in the farm.  Many of the parameter sets accept filters for specific scopes such as web application, site collection, and site.  If those are supplied then only the enabled / activated features are returned for that filtered scope.  Taking the concept of recursively traversing a SharePoint farm and merging that with calls to Get-SPFeature at all levels of the farm you can find out what features are activated at that level.  Store the results into a variable and you end up with all features that are activated at every level.

   Below is the script I came up with (slight edits for posting on blog).  With no parameters the function lists all features activated at all scopes.  If you provide an Identity parameter you will find where a specific feature is activated.  Note that the display name for a feature you see in the SharePoint UI rarely matches the “internal” display name.  I would recommend using the feature id instead.  You can download a full copy of the script by clicking on the link below.

   Note: This script is not optimized for medium to large farms.  In my testing it took 1-3 minutes to recurse through my demo environment.  This script is provided as-is with no warranty.  Run this in a smaller dev / test environment first.


function Get-SPFeatureActivated 
# see full script for help info, removed for formatting 
  [Parameter(position = 1, valueFromPipeline=$true)] 
)#end param 
    # declare empty array to hold results. Will add custom member ` 
    # for Url to show where activated at on objects returned from Get-SPFeature. 
    $results = @() 
    $params = @{} 
    if([string]::IsNullOrEmpty($Identity) -eq $false) 
      $params = @{Identity = $Identity 
            ErrorAction = “SilentlyContinue” 
    # check farm features 
    $results += (Get-SPFeature -Farm -Limit All @params | 
             % {Add-Member -InputObject $_ -MemberType noteproperty ` 
                -Name Url -Value ([string]::Empty) -PassThru} | 
             Select-Object -Property Scope, DisplayName, Id, Url) 

    # check web application features 
    foreach($webApp in (Get-SPWebApplication)) 
      $results += (Get-SPFeature -WebApplication $webApp -Limit All @params | 
               % {Add-Member -InputObject $_ -MemberType noteproperty ` 
                  -Name Url -Value $webApp.Url -PassThru} | 
               Select-Object -Property Scope, DisplayName, Id, Url) 
      # check site collection features in current web app 
      foreach($site in ($webApp.Sites)) 
        $results += (Get-SPFeature -Site $site -Limit All @params | 
                 % {Add-Member -InputObject $_ -MemberType noteproperty ` 
                    -Name Url -Value $site.Url -PassThru} | 
                 Select-Object -Property Scope, DisplayName, Id, Url) 
        # check site features in current site collection 
        foreach($web in ($site.AllWebs)) 
          $results += (Get-SPFeature -Web $web -Limit All @params | 
                   % {Add-Member -InputObject $_ -MemberType noteproperty ` 
                      -Name Url -Value $web.Url -PassThru} | 
                   Select-Object -Property Scope, DisplayName, Id, Url) 
} #end Get-SPFeatureActivated 


Snippet of output from Get-SPFeatureActivated



   This script has been requested for a long time and I’m glad to finally getting a working “clean” version.  If you find any bugs or issues with the script please let me know.  I’ll be posting this to the TechNet Script Center after some internal review.  Enjoy the script and I hope it helps with your admin / developer needs.


      -Frog Out

17 thoughts on “PowerShell Script To Find Where SharePoint 2010 Features Are Activated

  1. Originally posted on: http://briantjackett.com/archive/2012/07/02/powershell-script-to-find-where-sharepoint-2010-features-are-activated.aspx#623880


    Yes, a few posts later I posted a 2007 compatible script. Caution I did find some issues where that script reported different results when I ran it against a 2010 farm. Not sure why the inconsistencies but it may have been due to custom site templates or definitions. Let me know if you have any issues.

  2. Originally posted on: http://briantjackett.com/archive/2012/07/02/powershell-script-to-find-where-sharepoint-2010-features-are-activated.aspx#626027

    If I wanted to just search for a particular feature. Would I just remove the -limit all and replace it with -identity “name of feature” in each section. I’m not a developer 🙁 although i grasp the over all intent. I just am not sure where I should input a specific feature identity to get specific results.

  3. Originally posted on: http://briantjackett.com/archive/2012/07/02/powershell-script-to-find-where-sharepoint-2010-features-are-activated.aspx#626033


    You can run my custom function Get-SPFeatureActivated with the -identity parameter and supply the name of the feature. Unfortunately you will need to know the underlying name of the feature, not necessarily the display you see in the web browser.

    Ex. Get-SPFeatureActivated -identity “PublishingSite”

  4. Originally posted on: http://briantjackett.com/archive/2012/07/02/powershell-script-to-find-where-sharepoint-2010-features-are-activated.aspx#626035

    Quick response! Thank you because I feel I”m over here destroying your code with my “what if I do this” approach. lol
    I tried using Get-SPFeatureActivated -Identity “Basic Web Parts” at the very top of the function (if this is where I should put it) and I received the error Missing functionbody in function declaration. Again please excuse my lack of development prowess.

  5. Originally posted on: http://briantjackett.com/archive/2012/07/02/powershell-script-to-find-where-sharepoint-2010-features-are-activated.aspx#626094


    You’ll need to put that function execution call at the bottom of the script after the function has been declared. The other thing to do is ensure the “Basic Web Parts” name is correct. If you run the function by itself (just Get-SPFeatureActivated at the end of script) and then look through the output for that feature double check the name is correct. My bet is that it will actually have no spaces or be slightly different. Give that a try and see if it helps.

  6. Originally posted on: http://briantjackett.com/archive/2012/07/02/powershell-script-to-find-where-sharepoint-2010-features-are-activated.aspx#627906

    Well…I ran the script by itself and also tried adding the identity at the bottom of the function:
    } #end Get-SPFeatureActivated -identity “internalnamehere” and nothing. As soon as I hit enter it goes straight to the command prompt. Either way it hates me.lol I know this is something I”m doing and I’m winning the doh! award right now.

  7. Originally posted on: http://briantjackett.com/archive/2012/07/02/powershell-script-to-find-where-sharepoint-2010-features-are-activated.aspx#648671

    I’m trying to run this script and getting the following error. I get this error with or without the identity parameter being passed. Any help to resolve this is much appreciated.

    Get-SPFeatureActivated : Exception has been thrown by the target of an invocation.
    At line:82 char:23
    + Get-SPFeatureActivated <<<<
    + CategoryInfo : NotSpecified: (:) [Get-SPFeatureActivated], TargetInvocationException
    + FullyQualifiedErrorId : System.Reflection.TargetInvocationException,Get-SPFeatureActivated

Leave a Reply

Your email address will not be published. Required fields are marked *

ten + 8 =