Good day all,
I am migrating all of my install scripts to PowerShell for our migration to Workspace One/Airwatch. In my mind, the answer should be the same regardless of the management platform. I have built in error codes into my script based on what failed. In the past I have used:
exit $lastexitcode #or
A developer friend said I should use:
$host.SetShouldExit(0) #where 0 is the number you want to return
Poking around I found (https://serverfault.com/questions/716760/how-to-get-sccm-to-recognize-return-codes-from-powershell-script-completion/716824)
Instead of mindlessly stealing code I would like to understand why I should use what I am using.