PowerShell to List Activated Features for a Site and Web

Here is a snippet of Windows PowerShell code to list all the activated Features for a site collection (SPSite):

 Get-SPSite http://sharepoint2010 | % {

    $results = @()

    Get-SPFeature -Site $_ -Limit All | % {

    $feature = $_; 
        $featuresDefn = (Get-SPFarm).FeatureDefinitions[$_.ID]; 
        $cc = [System.Globalization.CultureInfo]::CurrentCulture;

        $obj = New-Object PSObject;
        $obj | Add-Member NoteProperty  Title  $($featuresDefn.GetTitle($cc));
        $obj | Add-Member NoteProperty  Hidden $($feature.Hidden);
        
        $results += $obj;
    }
    $results | FT -auto;
}

Here is a snippet of Windows PowerShell code to list all the activated Features for an individual web (SPWeb).

 Get-SPWeb http://sharepoint2010/subsite | % {

    $results = @()

    Get-SPFeature -Web $_ -Limit All | % {

        $feature = $_; 
        $featuresDefn = (Get-SPFarm).FeatureDefinitions[$_.ID]; 
        $cc = [System.Globalization.CultureInfo]::CurrentCulture;

        $obj = New-Object PSObject;
        $obj | Add-Member NoteProperty  Title  $($featuresDefn.GetTitle($cc));
        $obj | Add-Member NoteProperty  Hidden $($feature.Hidden);
        
        $results += $obj;
    }
    $results | FT -Auto;
}

Please note, this formatted output will not match the output you see on the ManageFeatures.aspx page for two reasons.  First, the ManageFeatures.aspx page will show you all of the deactivated Features in the farm that could be activated for the site collection or individual web as well as all of the activated Features for the site or web.  Second, the ManageFeatures.aspx page does not display Features marked as Hidden.

The output from this PowerShell script will show you the hidden and non-hidden Features that are activated for the site or web.