How to get SharePoint features using PowerShell

In this SharePoint PowerShell tutorial, we will see how to get sharepoint features using Powershell. The PowerShell script will also retrieve the hidden SharePoint features.

In SharePoint, we can enable and disable some feature with the help of features. In SharePoint, we can find 3 types of features.

  • Out Of the Box (OOB) features
  • Custom features
  • Hidden features

Get SharePoint Features using PowerShell

Now, we will see how to get features in SharePoint using PowerShell. We will be able to retrieve farm and site-level features in SharePoint 2013/2016.

The below PowerShell command will display features from the farm, it will show features from farm level, web application level, site collection level, site level also.

Now we will discuss, how to get a list of all the hidden features in SharePoint 2013. In SharePoint, we create a feature as hidden to avoid accidental clicks which could disable the important feature. In SharePoint, Microsoft has created many hidden features by default like the way how we have hidden lists.

Add-PSSnapin "Microsoft.SharePoint.PowerShell"
Get-SPFeature | Sort -Property DisplayName

It should show like below:

Get SharePoint 2013 Features using PowerShell
get installed features powershell sharepoint 2013

The below command will sort based on the scope as well as it will filter based on scope like first Farm, web application, site collection, etc.

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

Below PowerShell command which will display features within a particular SharePoint site collection:

Add-PSSnapin "Microsoft.SharePoint.PowerShell"
Get-SPFeature -Site https://SiteCollectionURL/ | Sort DisplayName | FT DisplayName,Id

Below command will display SharePoint features which are in web scope.

Add-PSSnapin "Microsoft.SharePoint.PowerShell"
Get-SPSite https://SiteCollectionURL/ | Get-SPWeb -Limit ALL | %{ Get-SPFeature -Web $_ } | Sort DisplayName -Unique

Below command will display features which are in web scope and it will filter based on DisplayName and ID.

Add-PSSnapin "Microsoft.SharePoint.PowerShell"
Get-SPSite https://SiteCollectionURL/ | Get-SPWeb -Limit ALL | %{ Get-SPFeature -Web $_ } | Sort DisplayName -Unique | FT DisplayName,Id

This is how we can retrieve features using PowerShell in SharePoint 2013/2016.

Get SharePoint hidden features using PowerShell

In SharePoint, if we want to list the hidden SharePoint features we have to either write an object model and read through all the features to determine the feature is hidden or not else we have to execute PowerShell commands

Hidden features can be created/existed with various scopes:

  • FARM
  • Web Application
  • Site Collection
  • Web

Now, we will see how to list the hidden features in SharePoint using PowerShell.

Open Microsoft SharePoint PowerShell command line window as an administrator. You can also read SharePoint 2013 PowerShell articles on Windows PowerShell ISE Tutorial and Debugging PowerShell with Visual Studio Code

Run the below command to list all the hidden features in SharePoint 2013 with the scope as “Web

Get-SPFeature -Limit ALL | Where-Object {$_.Hidden -eq $true -and $_.Scope -eq "Web"} | sort-object DisplayName | Get-Unique -asstring | Sort-Object DisplayName | Select DisplayName, Id, Scope
get SharePoint hidden features using PowerShell
get sharepoint features powershell

The below command will list all the hidden features with the scope as “Web Application

Get-SPFeature -Limit ALL | Where-Object {$_.Hidden -eq $true -and $_.Scope -eq "WebApplication"} | sort-object DisplayName | Get-Unique -asstring | Sort-Object DisplayName | Select DisplayName, Id, Scope

The below command will list all the hidden features with the scope as “Site Collection

Get-SPFeature -Limit ALL | Where-Object {$_.Hidden -eq $true -and $_.Scope -eq "Site"} | sort-object DisplayName | Get-Unique -asstring | Sort-Object DisplayName | Select DisplayName, Id, Scope

The below command will list all the hidden features with the scope as “FARM“.

Get-SPFeature -Limit ALL | Where-Object {$_.Hidden -eq $true -and $_.Scope -eq "FARM"} | sort-object DisplayName | Get-Unique -asstring | Sort-Object DisplayName | Select DisplayName, Id, Scope

Once you see the list you can enable any required feature with the below PowerShell command with the GUID of the feature.

Syn:
Enable-SPFeature –Identity "<<GUID>>" –url <<Site collection URL>> -PassThru

Ex:
Enable-SPFeature –Identity "af847aa9-beb6-41d4-8306-78e41af9ce25" –url http://sharepoint13:12345

You may like following PowerShell tutorials:

Hope this sharepoint 2013 PowerShell tutorial will help you to get installed features PowerShell sharepoint 2013 and how to get hidden SharePoint features using PowerShell.

  • First of all, thank you for writing such an article. every word is full of knowledge

  • >