Discovering, Activating, and Deactivating Features In A SharePoint Site Collection Using PowerShell

Mar 07 2012

Recently I had to deactivate/activate a hidden feature that was deployed to a SharePoint 2010 Site Collection.   It was deployed as hidden to prevent a critical capability from being turned off accidentally.  Hidden features do not show up on the Manage Site Features page, but they can be displayed using PowerShell. 

I needed to perform the following:
  • List the active features 
  • Deactivate/Activate the feature

List The Active Features

Getting the Feature list is pretty simple.  Run the following PowerShell Command from the SharePoint 2010 Management Shell (Replace http://SharePointSite/ with the site you would like to use):
Get-SPFeature -Site http://SharePointSite/ 
A list similar to the following will be returned displaying both the feature name and corresponding ID:


 

 

 

If you are not sure what Web the feature is activated in, run the following:

Get-SPSite http://SharePointSite/ | Get-SPWeb -Limit ALL | %{ Get-SPFeature -Web $_ } | Sort DisplayName -Unique | FT DisplayName,Id
This will return a distinct list of ALL features that are active in the Site Collection.

 

Deactivating the Feature

A feature can be disabled by name or ID.  In my case, I chose to deactivate and activate the feature by ID rather than name.  The name of the feature was too long and did not fully display in the results from above.
Disable-SPFeature –Identity FeatureNameHere –url http://SharePointSite/
or
Disable-SPFeature –Identity FeatureIDHere  –url http://SharePointSite/

Activating the Feature

To Activate the feature, do the same as above, but use Enable-SPFeature instead of Disable-SPFeature.
Enable-SPFeature –Identity FeatureNameHere –url http://SharePointSite/
or
Enable-SPFeature –Identity FeatureIDHere  –url http://SharePointSite/

References

 

About the Author

Mark DiGiovanni's picture

Mark DiGiovanni is a Senior Manager in the Systems Integration practice at CapTech. He has experience in SharePoint 2010, BizTalk, Custom .NET solutions, Apple, and Adobe technologies.

 

Disclaimer

The words and opinions expressed here are those of each article's respective author, and do not necessarily represent the views of CapTech Ventures.