V4.1.5 - Intune & deferral: issue exit code

Hi,
I'm almost sure I didn’t miss any existing topic related to this issue, so here it is:

I'm using the new version of PSADT 4.1.5 to deploy a package via Microsoft Intune.
The package shows a welcome screen with the option to Defer installation.

Everything looks fine in the local PSADT logs — I can clearly see the correct return code 1602 (indicating user deferral).
However, in Intune, the installation result is reported as exit code 1, as if PSADT didn’t pass the return code back to the Intune process properly.

Has anyone encountered the same behavior in 4.1.5?
Is this a known regression, or is there something that needs to be adjusted in the script to forward the exit code correctly?

That typically means you've got a syntax error in your script. Can you confirm you're looking at the right log or have packed up the right files?

Yes. Ive tried that with a two different packages.
One with a customized scripts, and one clean only with a welcomewindow.

Do you want more logs?

Will gather text logs from instalaltion.

What I'd recommend is enabling global PowerShell transcription to disk in case something funky is occurring after the session is closed out, but before PowerShell exits.

For your Intune device, you can do this locally via gpedit.msc or via a Settings Catalogue profile.

1 Like

[Win32App] lpExitCode 1 AppWorkload 10/6/2025 3:31:41 PM 18 (0x0012)

image

And from transcript:

Honestly I'm not sure what's going on there. Can you please show me your Intune install command?

Very basic: Invoke-AppDeployToolkit.ps1 -DeploymentType Install

powershell.exe -ExecutionPolicy Bypass .\Invoke-AppDeployToolkit.ps1 -DeploymentType Install

Well, there's your problem right there. When calling powershell.exe from the command line, never call your script without specifying -File. Your call is currently running as if you called Invoke-AppDeployToolkit.ps1 from the command line, so it's got no idea to exit with the exit code of the script.

Either do %windir%\sysnative\WindowsPowerShell\1.0\powershell.exe -ExecutionPolicy Bypass -File Invoke-AppDeployToolkit.ps1 -DeploymentType Install, or Invoke-AppDeployToolkit.exe, which we've shipped so that all of that boilerplate is managed for you.

1 Like