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 msi 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_msi-exitcode.ins"
References: http://desktopengineer.com/windowsinstallererrorcodes
;Den ExitCode des Installers abfragen set $ExitCode$ = getLastExitCode ;Loglevel anpassen setLogLevel = 4 ;Den ExitCode auswerten if ($ExitCode$ = "0" OR $ExitCode$ ="1641" OR $ExitCode$ ="3010") if ($ExitCode$ = "0") setLogLevel = 5 comment "ExitCode = "+$ExitCode$+" Action completed successfully." setLogLevel = 4 endif if ($ExitCode$ = "1641") setLogLevel = 5 comment "ExitCode = "+$ExitCode$+" ERROR_SUCCESS_REBOOT_INITIATED The installer has started a reboot. This error code not available on Windows Installer version 1.0." setLogLevel = 4 endif if ($ExitCode$ = "3010") setLogLevel = 5 comment "ExitCode = "+$ExitCode$+" ERROR_SUCCESS_REBOOT_REQUIRED A reboot is required to complete the install. This does not include installs where the ForceReboot action is run. This error code not available on Windows Installer version 1.0." setLogLevel = 4 endif else if ($ExitCode$ = "13") setLogLevel = 5 logError "ExitCode = "+$ExitCode$+" ERROR_INVALID_DATA The data is invalid." isFatalError endif if ($ExitCode$ = "87") setLogLevel = 5 logError "ExitCode = "+$ExitCode$+" ERROR_INVALID_PARAMETER One of the parameters was invalid." isFatalError endif if ($ExitCode$ = "120") setLogLevel = 5 logError "ExitCode = "+$ExitCode$+" ERROR_CALL_NOT_IMPLEMENTED This function is not available for this platform. It is only available on Windows 2000 and Windows XP with Window Installer version 2.0." isFatalError endif if ($ExitCode$ = "1259") setLogLevel = 5 logError "ExitCode = "+$ExitCode$+" ERROR_APPHELP_BLOCK This error code only occurs when using Windows Installer version 2.0 and Windows XP or later. If Windows Installer determines a product may be incompatible with the current operating system, it displays a dialog informing the user and asking whether to try to install anyway. This error code is returned if the user chooses not to try the installation." isFatalError endif if ($ExitCode$ = "1601") setLogLevel = 5 logError "ExitCode = "+$ExitCode$+" ERROR_INSTALL_SERVICE_FAILURE The Windows Installer service could not be accessed. Contact your support personnel to verify that the Windows Installer service is properly registered." isFatalError endif if ($ExitCode$ = "1602") setLogLevel = 5 logError "ExitCode = "+$ExitCode$+" ERROR_INSTALL_USEREXIT User cancel installation." isFatalError endif if ($ExitCode$ = "1603") setLogLevel = 5 logError "ExitCode = "+$ExitCode$+" ERROR_INSTALL_FAILURE Fatal error during installation." isFatalError endif if ($ExitCode$ = "1604") setLogLevel = 5 logError "ExitCode = "+$ExitCode$+" ERROR_INSTALL_SUSPEND Installation suspended, incomplete." isFatalError endif if ($ExitCode$ = "1605") setLogLevel = 5 logError "ExitCode = "+$ExitCode$+" ERROR_UNKNOWN_PRODUCT This action is only valid for products that are currently installed." isFatalError endif if ($ExitCode$ = "1606") setLogLevel = 5 logError "ExitCode = "+$ExitCode$+" ERROR_UNKNOWN_FEATURE Feature ID not registered." isFatalError endif if ($ExitCode$ = "1607") setLogLevel = 5 logError "ExitCode = "+$ExitCode$+" ERROR_UNKNOWN_COMPONENT Component ID not registered." isFatalError endif if ($ExitCode$ = "1608") setLogLevel = 5 logError "ExitCode = "+$ExitCode$+" ERROR_UNKNOWN_PROPERTY Unknown property." isFatalError endif if ($ExitCode$ = "1609") setLogLevel = 5 logError "ExitCode = "+$ExitCode$+" ERROR_INVALID_HANDLE_STATE Handle is in an invalid state." isFatalError endif if ($ExitCode$ = "1610") setLogLevel = 5 logError "ExitCode = "+$ExitCode$+" ERROR_BAD_CONFIGURATION The configuration data for this product is corrupt. Contact your support personnel." isFatalError endif if ($ExitCode$ = "1611") setLogLevel = 5 logError "ExitCode = "+$ExitCode$+" ERROR_INDEX_ABSENT Component qualifier not present." isFatalError endif if ($ExitCode$ = "1612") setLogLevel = 5 logError "ExitCode = "+$ExitCode$+" ERROR_INSTALL_SOURCE_ABSENT The installation source for this product is not available. Verify that the source exists and that you can access it." isFatalError endif if ($ExitCode$ = "1613") setLogLevel = 5 logError "ExitCode = "+$ExitCode$+" ERROR_INSTALL_PACKAGE_VERSION This installation package cannot be installed by the Windows Installer service. You must install a Windows service pack that contains a newer version of the Windows Installer service." isFatalError endif if ($ExitCode$ = "1614") setLogLevel = 5 logError "ExitCode = "+$ExitCode$+" ERROR_PRODUCT_UNINSTALLED Product is uninstalled." isFatalError endif if ($ExitCode$ = "1615") setLogLevel = 5 logError "ExitCode = "+$ExitCode$+" ERROR_BAD_QUERY_SYNTAX SQL query syntax invalid or unsupported." isFatalError endif if ($ExitCode$ = "1616") setLogLevel = 5 logError "ExitCode = "+$ExitCode$+" ERROR_INVALID_FIELD Record field does not exist." isFatalError endif if ($ExitCode$ = "1618") setLogLevel = 5 logError "ExitCode = "+$ExitCode$+" ERROR_INSTALL_ALREADY_RUNNING Another installation is already in progress. Complete that installation before proceeding with this install." isFatalError endif if ($ExitCode$ = "1619") setLogLevel = 5 logError "ExitCode = "+$ExitCode$+" ERROR_INSTALL_PACKAGE_OPEN_FAILED This installation package could not be opened. Verify that the package exists and that you can access it, or contact the application vendor to verify that this is a valid Windows Installer package." isFatalError endif if ($ExitCode$ = "1620") setLogLevel = 5 logError "ExitCode = "+$ExitCode$+" ERROR_INSTALL_PACKAGE_INVALID This installation package could not be opened. Contact the application vendor to verify that this is a valid Windows Installer package." isFatalError endif if ($ExitCode$ = "1621") setLogLevel = 5 logError "ExitCode = "+$ExitCode$+" ERROR_INSTALL_UI_FAILURE There was an error starting the Windows Installer service user interface. Contact your support personnel." isFatalError endif if ($ExitCode$ = "1622") setLogLevel = 5 logError "ExitCode = "+$ExitCode$+" ERROR_INSTALL_LOG_FAILURE Error opening installation log file. Verify that the specified log file location exists and is writable." isFatalError endif if ($ExitCode$ = "1623") setLogLevel = 5 logError "ExitCode = "+$ExitCode$+" ERROR_INSTALL_LANGUAGE_UNSUPPORTED This language of this installation package is not supported by your system." isFatalError endif if ($ExitCode$ = "1624") setLogLevel = 5 logError "ExitCode = "+$ExitCode$+" ERROR_INSTALL_TRANSFORM_FAILURE Error applying transforms. Verify that the specified transform paths are valid." isFatalError endif if ($ExitCode$ = "1625") setLogLevel = 5 logError "ExitCode = "+$ExitCode$+" ERROR_INSTALL_PACKAGE_REJECTED This installation is forbidden by system policy. Contact your system administrator." isFatalError endif if ($ExitCode$ = "1626") setLogLevel = 5 logError "ExitCode = "+$ExitCode$+" ERROR_FUNCTION_NOT_CALLED Function could not be executed." isFatalError endif if ($ExitCode$ = "1627") setLogLevel = 5 logError "ExitCode = "+$ExitCode$+" ERROR_FUNCTION_FAILED Function failed during execution." isFatalError endif if ($ExitCode$ = "1628") setLogLevel = 5 logError "ExitCode = "+$ExitCode$+" ERROR_INVALID_TABLE Invalid or unknown table specified." isFatalError endif if ($ExitCode$ = "1629") setLogLevel = 5 logError "ExitCode = "+$ExitCode$+" ERROR_DATATYPE_MISMATCH Data supplied is of wrong type." isFatalError endif if ($ExitCode$ = "1630") setLogLevel = 5 logError "ExitCode = "+$ExitCode$+" ERROR_UNSUPPORTED_TYPE Data of this type is not supported." isFatalError endif if ($ExitCode$ = "1631") setLogLevel = 5 logError "ExitCode = "+$ExitCode$+" ERROR_CREATE_FAILED The Windows Installer service failed to start. Contact your support personnel." isFatalError endif if ($ExitCode$ = "1632") setLogLevel = 5 logError "ExitCode = "+$ExitCode$+" ERROR_INSTALL_TEMP_UNWRITABLE The temp folder is either full or inaccessible. Verify that the temp folder exists and that you can write to it." isFatalError endif if ($ExitCode$ = "1633") setLogLevel = 5 logError "ExitCode = "+$ExitCode$+" ERROR_INSTALL_PLATFORM_UNSUPPORTED This installation package is not supported on this platform. Contact your application vendor." isFatalError endif if ($ExitCode$ = "1634") setLogLevel = 5 logError "ExitCode = "+$ExitCode$+" ERROR_INSTALL_NOTUSED Component not used on this machine" isFatalError endif if ($ExitCode$ = "1635") setLogLevel = 5 logError "ExitCode = "+$ExitCode$+" ERROR_PATCH_PACKAGE_OPEN_FAILED This patch package could not be opened. Verify that the patch package exists and that you can access it, or contact the application vendor to verify that this is a valid Windows Installer patch package." isFatalError endif if ($ExitCode$ = "1636") setLogLevel = 5 logError "ExitCode = "+$ExitCode$+" ERROR_PATCH_PACKAGE_INVALID This patch package could not be opened. Contact the application vendor to verify that this is a valid Windows Installer patch package." isFatalError endif if ($ExitCode$ = "1637") setLogLevel = 5 logError "ExitCode = "+$ExitCode$+" ERROR_PATCH_PACKAGE_UNSUPPORTED This patch package cannot be processed by the Windows Installer service. You must install a Windows service pack that contains a newer version of the Windows Installer service." isFatalError endif if ($ExitCode$ = "1638") setLogLevel = 5 logError "ExitCode = "+$ExitCode$+" ERROR_PRODUCT_VERSION Another version of this product is already installed. Installation of this version cannot continue. To configure or remove the existing version of this product, use Add/Remove Programs on the Control Panel." isFatalError endif if ($ExitCode$ = "1639") setLogLevel = 5 logError "ExitCode = "+$ExitCode$+" ERROR_INVALID_COMMAND_LINE Invalid command line argument. Consult the Windows Installer SDK for detailed command line help." isFatalError endif if ($ExitCode$ = "1640") setLogLevel = 5 logError "ExitCode = "+$ExitCode$+" ERROR_INSTALL_REMOTE_DISALLOWED Installation from a Terminal Server client session not permitted for current user." isFatalError endif if ($ExitCode$ = "1642") setLogLevel = 5 logError "ExitCode = "+$ExitCode$+" ERROR_PATCH_TARGET_NOT_FOUND The installer cannot install the upgrade patch because the program being upgraded may be missing or the upgrade patch updates a different version of the program. Verify that the program to be upgraded exists on your computer and that you have the correct upgrade patch. This error code is not available on Windows Installer version 1.0." isFatalError endif if ($ExitCode$ = "1643") setLogLevel = 5 logError "ExitCode = "+$ExitCode$+" ERROR_PATCH_PACKAGE_REJECTED The patch package is not permitted by system policy. This error code is available with Windows Installer versions 2.0 or later." isFatalError endif if ($ExitCode$ = "1644") setLogLevel = 5 logError "ExitCode = "+$ExitCode$+" ERROR_INSTALL_TRANSFORM_REJECTED One or more customizations are not permitted by system policy. This error code is available with Windows Installer versions 2.0 or later." isFatalError endif endif ;Loglevel anpassen setLogLevel = 6