SCCM Return Codes

Topics: Archive - General
Sep 16, 2013 at 5:17 AM
Anyone had a problem with return codes to SCCM using application deployment model?

The app deployment toolkit log says the following:

[16-09-2013 11:45:06] [Initialization] Citrix_Receiver_3.4_EN_01 Installation completed with exit code [2000].

But AppEnforce.log says:
Process 5940 terminated with exitcode: 1
Any reason why the script would not be returning the custom return code I specified?
Sep 16, 2013 at 8:54 AM
Turns out if I run powershell.exe with -NoP -NonI -ex bypass -file <script> it returns a proper return code.
Coordinator
Sep 16, 2013 at 12:04 PM
Hey there,

Do you get the correct exit code returned when using Deploy-Application.exe? Most of these PowerShell.exe parameters are already passed when using this.

Cheers, Dan
Feb 11, 2015 at 7:31 PM
We do not use the exe either so is there a way to pass the actual exit code back out to CM12?
I am seeing lots of (1) exit codes.

We do not use the exe as we have centrally deployed the supporting psadt files to all systems and then have the install script look in that location c:\windows\psadt. In this scenario the deploy-application fails to locate the needed files. Now if that is fixed in versions post 3.2.0 I will certainly try it but... This will allow for a more consistent install base for troubleshooting.

As always thanks in advance.
Feb 11, 2015 at 8:42 PM
We use a CMD wrapper in front of the PSADTK for legacy reasons:
set "_Powershell=%SYSTEMROOT%\system32\WindowsPowerShell\v1.0\powershell.exe"

"%_Powershell%" "& '%~dp0%FN%.ps1' Install NonInteractive "; exit $LASTEXITCODE
SET ERR=%ERRORLEVEL%
REM CAVEAT: we may get the wrong Exit code in PowerShell v2 (e.g. syntax error=0)

ECHO [%~NX0] SCCM RESULT CODE=%ERR%
TIMEOUT.exe /T 10 /NOBREAK 1>nul 2>nul

EXIT /B %ERR%
Notice the exit $LASTEXITCODE

You might be able to use that directly in CM12.