Execute-ProcessAsUser help

Is there a sure fire way to test this without uploading the package to intune first. when running this via Deploy-Application.exe or the ps1 directly it always fails with the following

[03-21-2024 11:58:23.810] [Installation] [Execute-Process] :: Execution failed with exit code [1].
[03-21-2024 11:58:23.822] [Installation] [Execute-ProcessAsUser] :: Failed to create the scheduled task by importing the scheduled task XML file [C:\Users%username%\AppData\Local\Temp\PSAppDeployToolkit\PSAppDeployToolkit-ExecuteAsUser.xml].

You’d have to bring in the PSADT package via USB or equivalent and run it elevated.

Personally I avoid Execute-ProcessAsUser and use ActiveSetup.

You could use the Windows Sandbox feature: (Windows Sandbox - Windows Security | Microsoft Learn)
and then install the Run in Sandbox Powershell module - there is a good guide for the whole process here:

1 Like

Thanks for the info, do you have a link to explain how to use this?

This explains how ActiveSetup works:
Active Setup Explained • Helge Klein

As for what the StubPath launches, it has to be independent from PSADT.

It can be an EXE, a CMD, or even a PS1 script.