tag:blogger.com,1999:blog-23427056965297963552024-03-08T07:37:14.021-08:00Deploy and retract solution from all site collections of a web application in MOSS2007Bhavin Prajapatihttp://www.blogger.com/profile/05741545840620919410noreply@blogger.comBlogger1125tag:blogger.com,1999:blog-2342705696529796355.post-48005258130790372712012-05-17T13:27:00.003-07:002012-05-17T13:27:45.122-07:00<div>
<b>The following scripts do not require any PowerShell, they are batch files so save them as .bat and run in command prompt. These have been tested on MOSS2007 and work.</b></div>
<b><span style="font-size: x-large;"><div>
<b><span style="font-size: x-large;"><br /></span></b></div>
Deployment</span></b><div>
<span style="font-size: x-large;"><b><br /></b></span><div>
<div>
<span style="font-size: x-small;">@SET STSADM="c:\program files\common files\microsoft shared\web server extensions\12\bin\stsadm.exe" </span></div>
<div>
<span style="font-size: x-small;">@Set rootsite="http://webapp"</span></div>
<div>
<span style="font-size: x-small;">set Sites="http://webapp","http://webapp/departments/CorporateFinance","http://webapp/departments/CSR","http://webapp/departments/hr_backup"</span></div>
<div>
<span style="font-size: x-small;">echo Adding solution 'solution.wsp' </span></div>
<div>
<span style="font-size: x-small;">%stsadm% -o addsolution -filename solution.wsp </span></div>
<div>
<span style="font-size: x-small;">echo Deploying solution 'solution.wsp' </span></div>
<div>
<span style="font-size: x-small;">%stsadm% -o deploysolution -name solution.wsp -url %rootsite% -immediate -allowGacDeployment -force </span></div>
<div>
<span style="font-size: x-small;">%stsadm% -o execadmsvcjobs</span></div>
<div>
<span style="font-size: x-small;">echo Installing 'solution.MasterPage' feature. </span></div>
<div>
<span style="font-size: x-small;">%stsadm% -o installfeature -name Solution.MasterPage -force </span></div>
<div>
<span style="font-size: x-small;">%stsadm% -o execadmsvcjobs</span></div>
<div>
<span style="font-size: x-small;"><br /></span></div>
<div>
<span style="font-size: x-small;">for %%i in (%Sites%) do (</span></div>
<div>
<span style="font-size: x-small;"><span class="Apple-tab-span" style="white-space: pre;"> </span>echo Activating 'solution.MasterPage' feature on %%i</span></div>
<div>
<span style="font-size: x-small;"><span class="Apple-tab-span" style="white-space: pre;"> </span>%stsadm% -o activatefeature -name solution.MasterPage -url %%i -force </span></div>
<div>
<span style="font-size: x-small;"><span class="Apple-tab-span" style="white-space: pre;"> </span>%stsadm% -o execadmsvcjobs </span></div>
<div>
<span style="font-size: x-small;">) </span></div>
<div>
<span style="font-size: x-small;"><br /></span></div>
<div style="font-size: xx-large; font-weight: bold;">
Retraction</div>
<div style="font-size: xx-large; font-weight: bold;">
<br /></div>
<div>
<div>
<span style="font-size: x-small;">@SET STSADM="c:\program files\common files\microsoft shared\web server extensions\12\bin\stsadm.exe" </span></div>
<div>
<span style="font-size: x-small;"><br /></span></div>
<div>
<span style="font-size: x-small;">set Sites="http://webapp","http://webapp/departments/CorporateFinance","http://webapp/departments/CSR","http://webapp/departments/hr_backup"</span></div>
<div>
<span style="font-size: x-small;">for %%i in (%Sites%) do (</span></div>
<div>
<span style="font-size: x-small;"><span class="Apple-tab-span" style="white-space: pre;"> </span>echo Deativating 'Solution.MasterPage' feature on %%i</span></div>
<div>
<span style="font-size: x-small;"><span class="Apple-tab-span" style="white-space: pre;"> </span>%stsadm% -o deactivatefeature -name Solution.MasterPage -url %%i -force </span></div>
<div>
<span style="font-size: x-small;">)</span></div>
<div>
<span style="font-size: x-small;">echo Uninstalling 'Solution.MasterPage' feature. </span></div>
<div>
<span style="font-size: x-small;">%stsadm% -o uninstallfeature -name Solution.MasterPage -force</span></div>
<div>
<span style="font-size: x-small;">%stsadm% -o execadmsvcjobs </span></div>
<div>
<span style="font-size: x-small;">echo Retracting solution 'Solution.wsp' </span></div>
<div>
<span style="font-size: x-small;">%stsadm% -o retractsolution -name Solution.wsp -immediate -allcontenturls </span></div>
<div>
<span style="font-size: x-small;">%stsadm% -o execadmsvcjobs </span></div>
<div>
<span style="font-size: x-small;">echo deleting solution 'Solution.wsp' </span></div>
<div>
<span style="font-size: x-small;">%stsadm% -o deletesolution -name Solution.wsp -override </span></div>
</div>
</div>
</div>Bhavin Prajapatihttp://www.blogger.com/profile/05741545840620919410noreply@blogger.com0