Install and Uninstall a Feature in SharePoint using stsadm.exe

Written by Denis Stadler on . Posted in IT Pro & PowerShell, SharePoint 2010

To deploy SharePoint Custom Features on different servers the easy way is to use stsadm.exe.

First, please:
– replace YourWSP.wsp with your WSP Package
– replace FeatureNameFolder with your Feature Folder Relative Path from 12 or 14 Hive \TEMPLATE\FEATURES (usually is should be the folder which contains the feature.xml file)
– replace http://site with your site

Using stsadm.exe for Installing Features and Packages in both MOSS 2007 and SharePoint 2010


rem Solution Package
rem ================
stsadm -o addsolution -filename YourWSP.wsp
stsadm -o deploysolution -name YourWSP.wsp -allowgacdeployment -force -immediate

rem Feature
rem ================
stsadm -o installfeature -filename FeatureNameFolder\feature.xml -force
stsadm -o activatefeature -filename FeatureNameFolder\feature.xml -url http://site -force

Using stsadm.exe for Uninstalling Features and Packages in both MOSS 2007 and SharePoint 2010


rem Feature
rem ================
stsadm -o deactivatefeature -filename FeatureNameFolder\feature.xml -force -url http://site
stsadm -o uninstallfeature -filename

rem Solution Package
rem ================
stsadm -o retractsolution -name YourWSP.wsp -url http://site -immediate
stsadm -o deletesolution -name YourWSP.wsp