u/AlkHacNar

▲ 1 r/SCCM

I have a Run Command Line step in my ts as following
cmd.exe /c start /wait powershell.exe -WindowStyle Maximized -executionpolicy bypass -file ".\myscript" -PassThru

the script have exit 69 at the end if a condition is met it shows a red text with the failed condition and awaits a key press before it exits, and the ts should run to failure, but it never gets to a failure, it exits with 0. Could it be that it gets the exit of start, which is running successful and if yes, what do I need to change for it to work? And no, I don't want to use ps step, if possible

EDIT: I figured it out, here the working code

cmd.exe /c start /wait powershell.exe -WindowStyle Maximized -executionpolicy bypass -file ".\myScript.ps1" -PassThru && exit %^ERRORLEVEL%

reddit.com
u/AlkHacNar — 15 days ago