Custom User Exit Codes

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 

    }

What are you using to deploy this (e.g. SCCM, Intune, other)
For example in Intune you can define additional exit codes via the Add button:

Hi Adrian,

Thanks for your response. I worked it out, I was trying to beat the sccm installation process by adding a custom code. I opted to u turn as essentially SCCM does not support a successful ‘abort’.

2 Likes

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.