Mapping to .ps1 inside execute-processasuser issue

I’m running a PSADT script as user, but running into issues “mapping” to it in Deploy-Application.ps1

I’d like to bundle it in the PSADT directory, and be able to call it from there.

Using this doesn’t work:
Execute-ProcessAsUser -Path "$PSHOME\powershell.exe" -Parameters "-Command & { & $SupportFiles\chrome.ps1”; Exit $LastExitCode }" -Wait

Moving it to C:\temp and pointing to the absolute path, works.
Execute-ProcessAsUser -Path "$PSHOME\powershell.exe" -Parameters "-Command & { & “C:\Temp\Scripts\chrome.ps1"; Exit $LastExitCode }” -Wait`

It’s as if $SupportFiles is a network path or something.

this works for me:

 Execute-Process -Path "powershell.exe" -Parameters "-Command & { & `"$dirFiles\pscommand.ps1`"; Exit `$LastExitCode }" -Wait

First issue was ID10T error, I used $SupportFiles instead of $dirSupportFiles, but when I fixed that, it still isn’t reading it. PSADT 3.8.4

Still not working (moved .ps1 to Files) and the script doesn’t run. I’m using the Execute-processasuser cmdlet, will see if that’s the issue.

Hardcoding the link, works, but don’t want to have to pre-seed the .ps1 file.

Thanks.

hardcoding works because you are using double quotes that preserve the literal string

take a look at the code i posted to see the difference

here is some more explanation: