I am working on creating a standard wrapper of sorts around my post-installation scripts, with an introduction, execution of installation package, error-catching, and notification of script end.

My method of detecting any error has been as such:

@ECHO OFF
echo ******************
echo Installing Aleks...
msiexec /i %~dp0aleks318.msi /qb
IF %ERRORLEVEL% EQU 0 GOTO success
GOTO error
:success
echo Aleks Installed.
echo ******************
GOTO END
:error
echo An error %ERRORLEVEL% occured. >> %systemroot%\Aleks_Error.log
GOTO END
:end
However, this particular software seems to exit setting ERRORLEVEL to 1 no matter what, although the software seems to be installed just fine.

So I am wondering if I should expect software installation packages to not always leave ERRORLEVEL as 0, even when the software installed without error.

Has anybody else set up a similar sort of mechanism? Is there any better ways to check for errors? 

 

0 Comments   [ + ] Show Comments

Comments

Please log in to comment

Answers

1

have you tried to set the errorlevel to 0 just before running the MSI? some internal system commands could also do this prior to the msi call.

http://www.incodesystems.com/products/errorle1.htm

Answered 01/31/2013 by: SMal.tmcc
Red Belt

Please log in to comment
1

I am not sure about client side error message!! but if you need exit codes for deployment troubleshoot you can use this bach command 

@ECHO OFF
echo ******************
echo Installing Aleks...
msiexec /i %~dp0aleks318.msi /qb

REM Return exit code to SCCM
exit /B %EXIT_CODE%

Answered 02/01/2013 by: ontari.ontari
Black Belt

Please log in to comment
0

Try using "START /WAIT" in front of your line for the install using "MSIEXEC" and see if it provides the correct results.  This should make the script wait for the installation to finish and read the correct value of the ErrorLevel.  Also, be sure that the path to the MSI does not contains spaces or special characters that would require the path to be enclosed in quotes.  If you pass an invalid path (or GUID) to MSIEXEC it will not update the ErrorLevel.

 

@ECHO OFF
echo ******************
echo Installing Aleks...
START /WAIT msiexec /i %~dp0aleks318.msi /qb
IF %ERRORLEVEL% EQU 0 GOTO success
GOTO error
:success
echo Aleks Installed.
echo ******************
GOTO END
:error
echo An error %ERRORLEVEL% occured. >> %systemroot%\Aleks_Error.log
GOTO END
:end

Answered 03/06/2013 by: M P
Purple Belt

Please log in to comment
Answer this question or Comment on this question for clarity