Sunday, April 10, 2011

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 SharePoint feature using stsadm
stsadm -o installfeature -filename {FeatureFolder}\feature.xml
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>

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 http://server/site/subsite or
$feature = Get-SPFeature -Identity e819dc7-70fd-41723-2323a

Reactivate features:
If you need to reactivate a same feature again, Use "-force" parameter.
Enable-SPFeature $featureID –Url "http://SharePointSite" -Force

To Deactivate a SharePoint Feature using Stsadm:
stsadm –o deactivatefeature –name MyFeatureName –url http://myspwebapp

$feature = Get-SPFeature -Identity e819dc7-70fd-41723-2323a
Disable-SPFeature $feature –Url "http://SharePointSite" -Force

Uninstall SharePoint feature using stsadm
stsadm -o uninstallfeature -filename {FeatureFolder}\feature.xml
UnInstall-SPFeature -Path "<feature Folder in 14 hive>"
or
$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 "http://SharePointSite"

To Displaying All Installed Site Features (Feature list using PowerShell)
Get-SPFeature –Web "http://SharePointSite"

To Get a Specific Feature:
$feature = Get-SPFeature -Identity e819dc7-70fd-41723-2323a



You might also like:
SharePoint Usage Reports
Usage reports, collaboration and audit for SharePoint.
Document SharePoint Farm
Automatically generate SharePoint documentation.
*Sponsored


Check out these SharePoint products:

No comments :

Post a Comment

Please Login and comment to get your questions answered!

You might also like:

Related Posts Plugin for WordPress, Blogger...