Client Management Suite

 View Only

Install/Uninstall Scripts for Installing/Uninstalling Packages 

Jul 19, 2012 03:32 PM

Though we package applications using the following methods,

1. Setup Capture method to produce MSI file
2. TRANSFORM method  creation to produce MST file
3. Silent response methods to produce ISS file etc...

We still need an install script that will install the package in the commandline. We often use BATCH files and VBScript files. For VBScript install scripts my friend ESHWAR has written an excellent article:

Installation Wrapper [vbscript] with Reboot Timeout for Software Delivery

I'm going to use command files [Install.cmd/Uninstall.cmd] for my day-to-day packaging and deployment in windows7x64 environment. Following is the default template that I use in my current project and I hope this can be useful for most of you who have not implemented or about to implement standards around install scripts.

Requirements:

1. The application should be installed in near silent or silent mode
2. standard LOG file should be generated under C:\SWDLogs folder
3. Exit codes 0, 1641 & 3010 means success and everything else is failure 

Install.cmd

=======================================================================================
Set MsiName=PKGID-VENDOR-APPLICATION_NAME-VERSION-1.0.msi
Set UPN=PKGID-VENDOR-APPLICATION_NAME-VERSION-1.0
Set LogFolder="C:\SWDLogs\%UPN%_Install.log"
if not exist "C:\SWDLogs" md "C:\SWDLogs"
 
msiexec.exe /i "%~dp0%MsiName%" /qb-! /l*v %LogFolder%
 
set insterror=%errorlevel%
if %insterror%==0 goto :Misc
if %insterror%==1641 goto :Misc
if %insterror%==3010 goto :Misc
 
goto :ERROR
 
:Misc
@echo Successfully Installed APPLICATION_NAME
goto :Einde
 
:ERROR
@echo Error Code is %insterror%if exist %LogFile% type %LogFile%
goto :Einde
 
:Einde
@echo Job ended at %date% %Time%

Exit %insterror% 

=======================================================================================

 

Uninstall.cmd

=======================================================================================

 

Set MsiName=PKGID-VENDOR-APPLICATION_NAME-VERSION-1.0.msi
Set UPN=PKGID-VENDOR-APPLICATION_NAME-VERSION-1.0
Set LogsFolder="C:\SWDLogs\%UPN%_Install.log"
if not exist "C:\SWDLogs" md "C:\SWDLogs"
 
msiexec.exe /x {A5D4DE6F-62F0-46B8-82AF-174FFC021157} /qb-! /l*v %LogFolder%
 
set uninsterror=%errorlevel%
if %uninsterror%==0 goto :Misc
if %uninsterror%==1641 goto :Misc
if %uninsterror%==3010 goto :Misc
 
 
goto :ERROR
 
:Misc
@echo Successfully Uninstalled APPLICATION_NAME
goto :Einde
 
:ERROR
@echo Error Code is %uninsterror%if exist %LogFile% type %LogFile%
goto :Einde
 
:Einde
@echo Job ended at %date% %Time%

Exit %uninsterror% 

=======================================================================================
 
Please make sure to place the Install.cmd & Uninstall.cmd files in the same folder as the package files [MSI & MST].
 

Some useful Naming Conventions:

Naming conventions plays a major role in standardizing the processes. We have the following naming conventions:

In case of Setup Capture MSI name should be as follows:

PKGID-Vendor-ApplicationName-Version-ReleaseVersion.MSI

In case of Transform creation method, MSI name should not be modified. However the TRANSFORM name should be as follows:

PKGID-Vendor-ApplicationName-Version-ReleaseVersion.MST

PKGID is a unique identifier for each package. Release Version starts from 1.0 and incremented when the package is reworked. This will ensure the tracking of how many times the package has been reworked.

 

I hope this information helps somebody. Thank you. 

 

Statistics
0 Favorited
2 Views
2 Files
0 Shares
1 Downloads
Attachment(s)
txt file
Install.cmd_.txt   619 B   1 version
Uploaded - Feb 25, 2020
txt file
Uninstall.cmd_.txt   656 B   1 version
Uploaded - Feb 25, 2020

Tags and Keywords

Comments

Feb 25, 2013 01:15 AM

You can repleace the following line with your EXE install/uninstall command:

msiexec.exe /x {A5D4DE6F-62F0-46B8-82AF-174FFC021157} /qb-! /l*v %LogFolder%

Example:

"%~dp0Setup.exe" -silent

Jan 24, 2013 04:39 AM

Hello,
firstly, I would like to thank you for sharing your script.
Would your script also work for .exe?
thanks

Jan 24, 2013 12:27 AM

Thanks a lot for sharing script...

Jan 24, 2013 12:24 AM

useful script.

Nov 06, 2012 03:09 PM

Thanks. the folder path will be C:\Users\<UserName>\Desktop\Install

If you can please share the script for both Windows 7 and windows XP

thanks

Nov 06, 2012 02:28 AM

You can create a simple VBscript that does this job. However location of the ISS file is very important. If it is under user's desktop folder then folder path in windows 7 will be C:\Users\<UserName>\Desktop. If the user file is under all user's desktop folder then the path will be C:\Users\Public\desktop.

Please note that SCCM will not have access to the user's profile as the software deployment will be carried out under SYSTEM account. So please let us know the Operating system and file path so that I can share you the script.

Nov 05, 2012 03:24 PM

 

How can I create a script wrapper for uninstalling the bellow string asuming that I have the uninst_setup.iss file saved on desktop?

C:\Program Files\InstallShield Installation Information\{4D9CA1B8-5FF5-47A7-8BDF-C37D1F9F55A5}\setup.exe" -l0x9 -removeonly -uninst /s /f1"c:\temp\uninst_setup.iss" /f2"c:\temp\setuppec.log

I can uninstall the string manually if I copy the uninst_setup.iss file to c:\temp then ran the above string in cmd.

I just need help on creating a wrapper to uninstall it on one shot through SCCM.

Thanks

Jul 20, 2012 10:16 PM

i have a lot of packaging scripts. will try to upload whenever I can.

Jul 20, 2012 06:16 AM

do you have more scripts? 

Related Entries and Links

No Related Resource entered.