Managing Features in SharePoint using PowerShell & STSADM
SharePoint Features are part of deployment unit that typically consists of set of functionality such as customization, application pages, list schema, etc. that can be activated and de-activated at various levels in SharePoint. Features consists of “Feature.xml” file and any other supporting element files.
Generally Features to be activated or deactivated from SharePoint User Interface. Apart from web interface, Features can be installed/activated/deactivated/uninstalled using STSADM tool, PowerShell, Or Object Model.
Feature Scope id defined by Scope attribute in feature.xml. They have four possible scopes:
- Farm
- Web application
- Site
- Web
How to install a SharePoint feature using stsadm?
stsadm -o installfeature -filename {FeatureFolder}\feature.xml
To install a feature using PowerShell:
Install-SPFeature -Path “FeatureFolder” -Force
Where the “FeatureFolder” refers to a folder in SharePoint hive (14/15/16).
To activate SharePoint feature using stsadm
stsadm -o activatefeature -name “feature-name” -url URL-of-the-site
Where the URL could be:
- web application URL
- site collection URL
- Sub site URL
Depending on the feature scope.
To activate a Feature in SharePoint 2010 using PowerShell
Enable-SPFeature “FeatureFolderName in 14 hive” -Url https://server/site/subsite
Reactivate features:
If you need to reactivate the same feature again, use “-force” parameter.
$feature = Get-SPFeature -Identity e819dc7-70fd-41723-2323a
Enable-SPFeature $featureID -Url “https://SharePointSite” -Force
To deactivate a SharePoint Feature using Stsadm:
stsadm -o deactivatefeature -name MyFeatureName -url https://myspwebapp
$feature = Get-SPFeature -Identity e819dc7-70fd-41723-2323a
Disable-SPFeature $feature -Url “https://SharePointSite” -Force
Uninstall SharePoint feature using stsadm
stsadm -o uninstallfeature -filename {FeatureFolder}\feature.xml
UnInstall-SPFeature -Path “<feature Folder in 14 hive>”
$feature = Get-SPFeature -Identity e819dc7-70fd-41723-2323a
Uninstall-SPFeature $feature -Force
Get Feature list (Display List of all installed Features):
Get-SPFeature -Farm
Display the features at the web application level:
Get-SPFeature -WebApplication “SharePoint – 8080”
To Display All Installed Site Collection Features
Get-SPFeature -Site “https://SharePointSite”
To Displaying All Installed Site Features (Feature list using PowerShell)
Get-SPFeature -Web “https://SharePointSite”
To Get a Specific Feature:
$feature = Get-SPFeature -Identity e819dc7-70fd-41723-2323a