Microsoft Products

Thursday, May 17, 2012

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.

Deployment

@SET STSADM="c:\program files\common files\microsoft shared\web server extensions\12\bin\stsadm.exe" 
@Set rootsite="http://webapp"
set Sites="http://webapp","http://webapp/departments/CorporateFinance","http://webapp/departments/CSR","http://webapp/departments/hr_backup"
echo Adding solution 'solution.wsp' 
%stsadm% -o addsolution -filename solution.wsp  
echo Deploying solution 'solution.wsp' 
%stsadm% -o deploysolution -name solution.wsp -url %rootsite% -immediate -allowGacDeployment -force 
%stsadm% -o execadmsvcjobs
echo Installing 'solution.MasterPage' feature. 
%stsadm% -o installfeature -name Solution.MasterPage -force 
%stsadm% -o execadmsvcjobs

for %%i in (%Sites%) do (
echo Activating 'solution.MasterPage' feature on %%i
%stsadm% -o activatefeature -name solution.MasterPage -url %%i -force 
%stsadm% -o execadmsvcjobs 

Retraction

@SET STSADM="c:\program files\common files\microsoft shared\web server extensions\12\bin\stsadm.exe" 

set Sites="http://webapp","http://webapp/departments/CorporateFinance","http://webapp/departments/CSR","http://webapp/departments/hr_backup"
for %%i in (%Sites%) do (
echo Deativating 'Solution.MasterPage' feature on %%i
%stsadm% -o deactivatefeature -name Solution.MasterPage -url %%i -force  
)
echo Uninstalling 'Solution.MasterPage' feature. 
%stsadm% -o uninstallfeature -name Solution.MasterPage -force
%stsadm% -o execadmsvcjobs 
echo Retracting solution 'Solution.wsp' 
%stsadm% -o retractsolution -name Solution.wsp -immediate -allcontenturls 
%stsadm% -o execadmsvcjobs 
echo deleting solution 'Solution.wsp' 
%stsadm% -o deletesolution -name Solution.wsp -override 

No comments:

Post a Comment