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 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

 

 Subscribe to my post

4 thoughts on “Script to retract sharepoint solution package (wsp) and deactivate features

  1. Pingback: Script to retract sharepoint solution package (wsp) and deactivate features - My experiments with SharePoint, Azure and .NET using Visual Studio

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.