STSADM.exe Command-Line Snippets

      No Comments on STSADM.exe Command-Line Snippets

Here are the common stsadm properties commonly used in our applications for Automating the deployment.
we can get this each snippet to each cmd files and call accordingly with properties

————————————————
ECHO Creating web…”%STSADM_PATH%STSADM.EXE” -o createweb -url %WEB_URL% -sitetemplate %SOLUTION_NAME% -title %TITLE% -description “%DESCRIPTION%” %ARGUMENTS%
————————————————
ECHO Deleting web…”%STSADM_PATH%STSADM.exe” -o deleteweb -url %WEB_URL% %ARGUMENTS%
————————————————
ECHO Activating Feature: “%FEATURE_NAME%”…”%STSADM_PATH%STSADM.EXE” -o activatefeature -filename %FEATURE_NAME% -url %SITE_COLLECTION_URL% -force %ARGUMENTS%
————————————————
ECHO Started InfoPath Form Activation…
CD /d %FORM_PATH%
“%STSADM_PATH%STSADM.exe” -o ActivateFormTemplate -url %SITE_COLLECTION_URL% -filename “%FORM_NAME%”
if %ERRORLEVEL% NEQ 0 goto errors
ECHO InfoPath Form Activated …Successfully
ECHO Executing the AdminSVC Jobs
“%STSADM_PATH%STSADM.exe” -o execadmsvcjobs
————————————————
ECHO.ECHO Adding Solution…
CD %SOLUTION_PATH%
“%STSADM_PATH%STSADM.exe” -o addsolution -filename %SOLUTION_PATH%%SOLUTION_NAME% %ARGUMENTS%
ECHO Clearing Admin Queue…
“%STSADM_PATH%STSADM.exe” -o EXECADMSVCJOBS
————————————————
@ECHO OFF
SET STSADM_PATH=%1
SET FILEPATH=%2
SET FILENAME=%3
SET TITLE=%4
SET DESCRIPTION=CWS is a tenant of LEAP
SET ARGUMENTS=%5
SET NEWCHAR=/”
SET NEWDESCRIPTION=%DESCRIPTION%
SET i=%DESCRIPTION:~0,1%if “%i%” == “” (
SET NEWDESCRIPTION=%NEWCHAR%%DESCRIPTION:~2,-2%%NEWCHAR% )
ECHO.
ECHO %NEWDESCRIPTION%
ECHO Adding Template: %FILENAME%…
“%STSADM_PATH%STSADM.EXE” -o addtemplate -filename “%FILEPATH%%FILENAME%” -title %TITLE% -description “%DESCRIPTION%”
ECHO Performing IISRESET
IISRESET
————————————————
CheckIfInfoPathTemplateExists.cmd
ECHO.
ECHO Enumerating available forms…
“%STSADM_PATH%STSADM.exe” -o ENUMFORMTEMPLATES %ARGUMENTS%
————————————————
CheckInfoPathTemplate.cmd
“%STSADM_PATH%STSADM.exe” -o enumformtemplates
————————————————
ClearAdminQueue.cmd
SET STSADM_PATH=%1″%STSADM_PATH%STSADM.exe” -o EXECADMSVCJOBS
————————————————
DeActivateFeature.cmd
ECHO.
ECHO De-Activating Feature: “%FEATURE_NAME%”…
“%STSADM_PATH%STSADM.exe” -o deactivatefeature -filename %FEATURE_NAME% -url %SITE_COLLECTION_URL% -force %ARGUMENTS%
————————————————
DeActivateFormTemplate.cmd
ECHO.
ECHO Deactivating form template…
CD /d %FORM_PATH%”
%STSADM_PATH%STSADM.exe” -o DeActivateFormTemplate -url %SITE_COLLECTION_URL% -filename “%FORM_NAME%” %ARGUMENTS%
————————————————
DeleteSolution.cmd
ECHO.ECHO Deleting Solution…
“%STSADM_PATH%STSADM.exe” -o deletesolution -name %SOLUTION_NAME% %ARGUMENTS%
ECHO Clearing Admin Queue…
“%STSADM_PATH%STSADM.exe” -o EXECADMSVCJOBS
————————————————
DeleteTemplate.cmd
ECHO.
ECHO Adding Template: “%FILENAME%”…
“%STSADM_PATH%STSADM.exe” -o deletetemplate -title %TITLE%
ECHO Performing IISRESET
iisreset /noforce
————————————————
DeleteWeb.cmd
ECHO.
ECHO Deleting web…
“%STSADM_PATH%STSADM.exe” -o deleteweb -url %WEB_URL% %ARGUMENTS%
————————————————
DeployFormTemplate.cmd
ECHO.ECHO Uploading form…
CD /d %FORM_PATH%
“%STSADM_PATH%STSADM.exe” -o UploadFormTemplate -filename “%FORM_NAME%” %ARGUMENTS%
IF %ERRORLEVEL% NEQ 0 GOTO ERROR
“%STSADM_PATH%STSADM.exe” -o EXECADMSVCJOBS
IF %ERRORLEVEL% NEQ 0 GOTO ERROR
ECHO Activating Form Template “%FORM_NAME%”…
CD /d
%FORM_PATH%”%STSADM_PATH%STSADM.exe” -o ActivateFormTemplate -url %SITE_COLLECTION_URL% -filename “%FORM_NAME%” %ARGUMENTS%
:ERROR

————————————————DeploySolution.cmd
ECHO.
if “%ARGUMENTS%” EQU “local” (
ECHO Deploying Solution…
ECHO “%STSADM_PATH%STSADM.exe” -o deploysolution -name %SOLUTION_NAME% -local -allowGacDeployment
“%STSADM_PATH%STSADM.exe” -o deploysolution -name %SOLUTION_NAME% -local -allowGacDeployment )
if “%ARGUMENTS%” NEQ “local” (
ECHO Deploying Solution…
ECHO “%STSADM_PATH%STSADM.exe” -o deploysolution -name %SOLUTION_NAME% -url %URL% -immediate -allowgacdeployment %ARGUMENTS%
“%STSADM_PATH%STSADM.exe” -o deploysolution -name %SOLUTION_NAME% -url %URL% -immediate -allowgacdeployment %ARGUMENTS%)

ECHO Clearing Admin Queue…
“%STSADM_PATH%STSADM.exe” -o EXECADMSVCJOBS
————————————————ExecuteJob.cmd
ECHO.
ECHO Running Job: “%JOBNAME%”…
“%STSADM_PATH%STSADM.exe” -o %JOBNAME% %ARGUMENTS%

————————————————Extract.cmd
CABARC.EXE -p x CWS25_FE.cab
————————————————InstallDLLsToGAC.cmd
:: Example:: InstallDLLsToGAC.cmd -i MS.IT.PA.Innovation.SPDeploymentFramework.dll
@ECHO ON
SET GACUTIL_PATH=%1SET DLL_NAME=%2SET ARGUMENTS=%3
CD /d “%GACUTIL_PATH%”
ECHO.ECHO Installing %DLLNAME%…ECHO %GACUTIL_PATH%
GACUTIL.exe -f -i %DLL_NAME%
ECHO Completed
————————————————InstallFeature.cmd
ECHO.
ECHO Installing Feature: “%FEATURE_NAME%”…
“%STSADM_PATH%STSADM.exe” -o installfeature -filename %FEATURE_NAME% -force %ARGUMENTS%
————————————————RemoveFormTemplate.cmd
ECHO.
ECHO Removing Form Template from Managed Form Templates…
CD /d %FORM_PATH%”%STSADM_PATH%STSADM.exe” -o RemoveFormTemplate -filename “%FORM_NAME%” %ARGUMENTS%
————————————————RetractSolution.cmd
ECHO.
ECHO Retracting Solution…
if “%ARGUMENTS%” EQU “local” (
ECHO “%STSADM_PATH%STSADM.exe” -o retractsolution -name %SOLUTION_NAME% -local
“%STSADM_PATH%STSADM.exe” -o retractsolution -name %SOLUTION_NAME% -local)
if “%ARGUMENTS%” NEQ “local” (
ECHO “%STSADM_PATH%STSADM.exe” -o retractsolution -name %SOLUTION_NAME% -url %SOL_URL% -immediate %ARGUMENTS%
“%STSADM_PATH%STSADM.exe” -o retractsolution -name %SOLUTION_NAME% -url %SOL_URL% -immediate %ARGUMENTS%)
ECHO Clearing Admin Queue…
“%STSADM_PATH%STSADM.exe” -o EXECADMSVCJOBS
————————————————UnInstallDLLsFromGAC.cmd
“%GACUTIL_PATH%GACUTIL.exe” -f -u %DLL_NAME%
————————————————UnInstallFeature.cmdECHO.ECHO UnInstalling Feature: “%FEATURE_NAME%”…
“%STSADM_PATH%STSADM.exe” -o uninstallfeature -filename %FEATURE_NAME% -force %ARGUMENTS%
————————————————–UploadFormTemplate.cmd
ECHO.
ECHO Uploading form…
CD /d %FORM_PATH%”%STSADM_PATH%STSADM.exe” -o UploadFormTemplate -filename “%FORM_NAME%”
——————————————————–CreateWebApplication.cmd
ECHO.ECHO Creating web application…
CD /d %STSADM_PATH%
ECHO STSADM.EXE -o extendvs -url %WEB_URL% -ownerlogin %OWNER_LOGIN% -owneremail %OWNEREMAILID% -databaseserver %SHAREPOINTDBSERVER% -databasename LeapService_WSS_ContentDatabase -apidname LeapService_WSS_AppPool -apidtype NetworkService -donotcreatesite -exclusivelyusentlm -sethostheader -description %DESCRIPTION%

STSADM.EXE -o extendvs -url %WEB_URL% -ownerlogin %OWNER_LOGIN% -owneremail %OWNEREMAILID% -databaseserver %SHAREPOINTDBSERVER% -databasename LeapService_WSS_ContentDatabase -apidname LeapService_WSS_AppPool -apidtype NetworkService -donotcreatesite -exclusivelyusentlm -sethostheader -description %DESCRIPTION%

ECHO Resetting the IISIISRESET
ECHO InstallContentDBSTSADM.EXE -o restore -url %WEB_URL% -filename %LEAPDATALOC% -overwrite

———————————————————-
DeleteWebApplication.cmd
ECHO.
ECHO Deleting Web Application …
“%STSADM_PATH%STSADM.exe” -o unextendvs -url %WEB_URL% %DELCONTENT% %DELIISSITES% %ARGUMENTS%
ECHO IISRESET
IISRESET
———————————————–
echo yCACLS “C:SellKeysTemp” /E /R “FAREASTleapuata”
echo yCACLS C:SellKeysTemp” /T /E /G “Network Service”:C
ECHO Revoking permission…
echo yCACLS %DIRECTORY_NAME% /E /R %PERMISSION_ALIAS%
—————————————————————————
—————————————————————————

Leave a Reply