Returning SCCM Install Status to Batch?
Hi everyone, I'm working on a little repair script within our enterprise, and during the process this includes reinstalling SCCM (with the command line parameters from a batch file) This works well, but I'm looking to employ some error handling. My problem is (I think!) this: - The batch file calls the .exe - The .exe calls the .msi - The .MSI Reports the exit code to the .exe - The .exe reports its own exit code to the batch file This leaves the batch file unable to detect whether the install was successful or not. Does this sound plausibly like the issue? If so, is there a way to pass the MSI's exit code to the .bat directly? Thanks for any advice or input :-)
August 25th, 2012 3:32am

You can use the exit code reported by the .exe to exit the batch, so ConfigMgr will know how the .exe ended.Torsten Meringer | http://www.mssccmfaq.de
Free Windows Admin Tool Kit Click here and download it now
August 25th, 2012 5:10am

Hi Torsten, Thanks for your response. I'm not sure if I'm doing it wrong now, but it's definitely not reporting back a correct error level. Here's basically what I'm doing: ccmsetup.exe (arguments) ECHO: %ERRORLEVEL% This is returning 1 every time - even on a successful install. Am I doing this wrong? Thank you once again!
August 25th, 2012 6:52am

Just use ccmsetup.exe (arguments) or ccmsetup.exe (arguments) exit %ERRORLEVEL% Torsten Meringer | http://www.mssccmfaq.de
Free Windows Admin Tool Kit Click here and download it now
August 25th, 2012 7:29am

Just use ccmsetup.exe (arguments) or ccmsetup.exe (arguments) exit %ERRORLEVEL% Torsten Meringer | http://www.mssccmfaq.de Thanks again for the response Torsten. This one is also problematic, as the script I'm hoping to do will continue on, and dependant on the result, do some further troubleshooting. Is there a way to report back the errorlevel without exiting the bat?
August 25th, 2012 8:32am

Then use a conditional and store %ERRORLEVEL% in another variable and then later in the script you can use this variable as the return/exit value: if ERRORLEVEL 1 exit %ERRORLEVEL% set CCMSETUPERRORLEVEL = %ERRORLEVEL% ... exit %CCMSETUPERRORLEVEL% Note that I'm not positive if you need the %ERRORLEVEL% at the end of the first line above -- test it out and see.Jason | http://blog.configmgrftw.com
Free Windows Admin Tool Kit Click here and download it now
August 25th, 2012 8:43am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics