After the deployment of a package which runs an MSI install or uninstall, Command Center shows an Error status for both the package and computer. However, upon examination of the client computer, it appears that the MSI action completed successfully.
iCommand or LiveState Delivery package runs an MSI file or other type of installer which returns a non-zero value for success.
From the package, call a BAT file, let's call it runmsi.bat, like this:
The runmsi.bat file should be included with the Script fileset. Its contents may be something like this:
- @echo on
cmd.exe /c msiexec.exe /i "\\%DEPOT_SERV%\%DEPOT_SERV_SHARE%\%DEPOTDIR%\whatever.msi" /qb
echo "errorlevel = %errorlevel%"
if "%errorlevel%" == "3010" goto needreboot
if "%errorlevel%" == "1638" goto alreadyinst
if not "%errorlevel%" == "0" goto err
if "%errorlevel%" == "0" goto end
rem print message and return success
echo "Msiexec installation was successful, but it requires a reboot."
rem print message and return zero (so the package doesn¿t error)
echo "Msiexec returned 1638, product already installed"
exit /b 0
rem print message and return errorlevel so package errors
echo "Error: Msiexec failed with errorlevel = %errorlevel%"
exit /b %errorlevel%
The MSI file in this example would be part of the Vendor fileset. Call the msiexec command from within a bat file to prevent the Windows Agent from detecting a non-zero return value, which puts it into an Error status. Trap the non-zero return value by checking for all possible successful return values (3010 and 0 in this example). Contact the original author of the installer for a list of possible successful return values.
Also in this example, note the check for errorlevel 1638, which means that the msiexec installer found an existing version of the software that it is trying to install.
When the return value from the msiexec call is an actual error, return a non-zero value back to the package using the "exit /b value" command. This sets the package to an Error status.