The following snippet contains the script to retract sharepoint solution packages and de-activate features. This would be become handy to the sharepoint adminstrators, when they want to retract multiple solution packages (wsp) and de-activate multiple features.
:begin
@echo off
rem ** declare the solution to be retracted **
set solutionName=SampleSolution
rem ** declare the set of fetures to be de-activated **
set featureSampleFeature1=SampleFeature1
set featureSampleFeature2=SampleFeature2
set featureSampleFeature3=SampleFeature3
rem ** Replace this value with the URL of your site **
@set url=http://servername/sites/sitecollectioname/sitename
@set PATH=C:Program FilesCommon FilesMicrosoft Sharedweb server extensions12BIN;%PATH%
echo deactivating features in solution %solutionName%…
echo —————————————————-
stsadm -o deactivatefeature -name %featureSampleFeature1% -url %url% -force
stsadm -o deactivatefeature -name %featureSampleFeature2% -url %url% -force
stsadm -o deactivatefeature -name %featureSampleFeature3% -url %url% -force
echo Attempting to uninstallfeature and retract solution
echo —————————————————
echo Rectracting solution %solutionName% from solution store…
stsadm -o retractsolution -name %solutionName%.wsp -immediate
stsadm -o execadmsvcjobs
echo Deleting solution %solutionName% from solution store…
stsadm -o deletesolution -name %solutionName%.wsp -override
echo.
if errorlevel == 0 goto :success
:success
echo Successfully deployed solution and activated feature(s)..
echo .
goto end
:end
pause
Pingback: Script to retract sharepoint solution package (wsp) and deactivate features - My experiments with SharePoint, Azure and .NET using Visual Studio
Thanks a lot for this helpfull scripts
It is possible to do it from SP 2010 Central Administration UI?
If you use -local, the command is synchronized and there is no need to do “execadmsvcjobs”.
For example:
stsadm -o retractsolution -name %solutionName%.wsp -local