3

If i want to get the Features that are activated on a WebApplication, i can use the SPWebApplication.Features property, which will return a SPFeatureCollection with the Features activated for the WebApplication.

If i want to get a collection with the Farm-scoped Features that are activated on a SharePoint-Farm, there is not an easy way (as in the above for WebApps) to achieve this, since there is no 'SPFarm.Features' [or similar] property.

So how do i get a collection of farm-scoped features that are activated ?

0

3 Answers 3

4

To get the SPFeatureCollection for the farm-scoped features in the same fashion as SPWebApplication.Features, you use the SPWebService.AdministrationService. In PowerShell:

[Microsoft.SharePoint.Administration.SPWebService]::AdministrationService.Features

In C#:

Microsoft.SharePoint.Administration.SPWebService.AdministrationService.Features
2

To get all features grouped by Scope (Farm, WebApplication, Site, Web):

Get-SPFeature | Sort -Property Scope, DisplayName | FT -GroupBy Scope DisplayName, Id

To get Farm features only:

Get-SPFeature | Where {$_.Scope -eq "Farm"} | Select DisplayName, Id | Sort -Property Scope, DisplayName

2

Use below Powershell to get all activated features in the farm

$farmFeatures = Get-SPFeature -Farm 

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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