Execute-ProcessAsUser - Failed to create the scheduled task

I’m building my first complex script and have encountered this problem with Execute-ProcessAsUser: Failed to create the scheduled task by importing the scheduled task XML file

I found one thread on the forum, but it was specific to running under SCCM. I’m just trying to run it directly while I build and test the script. I have to run it as the logged in user because the executable is on a mapped drive. The error happens whether I run the ps1 file directly in PowerShell or by using deploy-application.exe.

Any suggestions?

SOLVED - I added -RunLevel LeastPrivilege to the Execute-ProcessAsUser and it started working perfectly.