How can I find all activated Farm features using PowerShell?
All installed Farm features can be found using:
Get-SPFeature -farm
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It only takes a minute to sign up.
Sign up to join this communitythis MS developer blog by Joe Rodgers helped us with:
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;
}
As per msdn
The Get-SPFeature cmdlet behaves differently at each scope, returning the enabled Features at each level. If no scope is provided, all installed Features are returned
That means below command will return only active list of features
Get-SPFeature -Farm
Here is another snippet that gives the same result
$siteFeatures = Get-SPFeature | Where-Object {$_.Scope -eq "Farm" }
if ($siteFeatures -ne $null) {
foreach ($feature in $siteFeatures) {
if ((Get-SPFeature -Farm | Where-Object {$_.Id -eq $feature.id}) -neq $null) {
Write-Host "$($feature.Scope) feature $($feature.DisplayName) " -ForeGroundColor DarkRed
}
}
}
You need to get the activated features by the AdministrationService
Powershell :
[Microsoft.SharePoint.Administration.SPWebService]::AdministrationService.Features
C# :
Microsoft.SharePoint.Administration.SPWebService.AdministrationService.Features