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.