I’ve added a custom user exit code 70000 which is in the reserved range for user exit codes.
I want to exit installation with success rather than fail to minimise user interaction.
The function that triggers the exit code is the Test-Battery function which is working and not returning an error. I have checked $LASTEXITCODE via start-Process and the only code is 70000 but Windows sees this as an application installation error rather than pass which is technically correct.
However if I can supress the output that would be preferred. Also SCCM is stating error even though I have put in the return code 70000 as a success code.
I cannot see any hardcoded return codes in the configuration.xml nor the ApplicationMain.
The small block of code that is executing is:
##===============================================
## PRE-INSTALLATION
##*===============================================
(Test-Battery -PassThru).IsLaptop
If((Test-Battery -PassThru).IsLaptop -ne $true) {
Exit-Script -ExitCode 70000
}