check_installshield-exitcode

Script by Der-Matze
Comments and improvements welcome

Tested with opsi 4.0.1
Tested with opsi-winst 4.10.x - 4.11.1.6
Tested with Windows XP Professional and Windows 7 Enterprise x64

Subscript that checks all available installshield exitcodes, writes the definition of the encountered exitcode to the logfile and determines if the installation was successful or not.
Makes debugging installations easier and assures that failed installations show up as failed in configed.

Usage:

Winbatch_Install
 
	sub "%ScriptDrive%\install\check_exitcode\check_installshield-exitcode.ins"

References: http://www.appdeploy.com/tips/detail.asp?id=20

check_installshield-exitcode.ins

;Den ExitCode des Installers abfragen
	set $ExitCode$ = getLastExitCode
 
 
 
;Loglevel anpassen
	setLogLevel = 4
 
 
 
;Den ExitCode auswerten
 
if ($ExitCode$ = "0")
	setLogLevel = 5
		comment "ExitCode = "+$ExitCode$+" Success"
			setLogLevel = 4
 
endif
 
 
 
if ($ExitCode$ = "-1")
 
	logError "ExitCode = "+$ExitCode$+" General error"
		isFatalError
 
endif
 
 
 
if ($ExitCode$ = "-2")
 
	logError "ExitCode = "+$ExitCode$+" Invalid mode"
		isFatalError
 
endif
 
 
 
if ($ExitCode$ = "-3")
 
	logError "ExitCode = "+$ExitCode$+" Required data not found in the Setup.iss file"
		isFatalError
 
endif
 
 
 
if ($ExitCode$ = "-4")
 
	logError "ExitCode = "+$ExitCode$+" Not enough memory available"
		isFatalError
 
endif
 
 
 
if ($ExitCode$ = "-5")
 
	logError "ExitCode = "+$ExitCode$+" File does not exist"
		isFatalError
 
endif
 
 
 
if ($ExitCode$ = "-6")
 
	logError "ExitCode = "+$ExitCode$+" Cannot write to the response file"
		isFatalError
 
endif
 
 
 
if ($ExitCode$ = "-7")
 
	logError "ExitCode = "+$ExitCode$+" Unable to write to the log file"
		isFatalError
 
endif
 
 
 
if ($ExitCode$ = "-8")
 
	logError "ExitCode = "+$ExitCode$+" Invalid path to the InstallShield Silent response file"
		isFatalError
 
endif
 
 
 
if ($ExitCode$ = "-9")
 
	logError "ExitCode = "+$ExitCode$+" Not a valid list type (string or number)"
		isFatalError
 
endif
 
 
 
if ($ExitCode$ = "-10")
 
	logError "ExitCode = "+$ExitCode$+" Data type is invalid"
		isFatalError
 
endif
 
 
 
if ($ExitCode$ = "-11")
 
	logError "ExitCode = "+$ExitCode$+" Unknown error during setup"
		isFatalError
 
endif
 
 
 
if ($ExitCode$ = "-12")
 
	logError "ExitCode = "+$ExitCode$+" Dialogs are out of order"
		isFatalError
 
endif
 
 
 
if ($ExitCode$ = "-51")
 
	logError "ExitCode = "+$ExitCode$+" Cannot create the specified folder"
		isFatalError
 
endif
 
 
 
if ($ExitCode$ = "-52")
 
	logError "ExitCode = "+$ExitCode$+" Cannot access the specified file or folder"
		isFatalError
 
endif
 
 
 
if ($ExitCode$ = "-53")
 
	logError "ExitCode = "+$ExitCode$+" Invalid option selected"
		isFatalError
 
endif
 
 
 
;Loglevel anpassen
	setLogLevel = 6