Script to retract sharepoint solution package (wsp) and deactivate features

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 Files\Common Files\Microsoft Shared\web server extensions\12\BIN;%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

 

Published Tue, Oct 13 2009 15:38 by lavssun

Comments

# re: Script to retract sharepoint solution package (wsp) and deactivate features

Monday, November 02, 2009 5:26 PM by Ethan Deng

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

Leave a Comment

(required) 
(required) 
(optional)
(required) 
Powered by Community Server (Commercial Edition), by Telligent Systems