Issues with Execute-ProcessAsUser

Hi everyone!

First of all we are currently beginning our journey towards using PSADT and I have successfully used 3.8.4 earlier but now Execute-ProcessAsUser seems to be broken.

I am trying to find where the issues is and so far it seems to be when it’s checking the literal path and it’s telling me that the variable cannot be null.

I am calling this function in Deploy-Application.ps1

Execute-ProcessAsUser -Path "C:\Windows\system32\notepad.exe"
(even tried with ’ instead of ")

This is the error from the log:

[Installation] :: Error Record:
-------------

Message        : Cannot bind argument to parameter 'LiteralPath' because it is an empty string.
InnerException : 

FullyQualifiedErrorId : ParameterArgumentValidationErrorEmptyStringNotAllowed,Microsoft.PowerShell.Commands.TestPathCom
                        mand
ScriptStackTrace      : at Execute-ProcessAsUser<Process>, 
                        C:\temp\td_snap\install\AppDeployToolkit\AppDeployToolkitMain.ps1: line 7476
                        at <ScriptBlock>, C:\temp\td_snap\install\Deploy-Application.ps1: line 209
                        at <ScriptBlock>, <No file>: line 1
                        at <ScriptBlock>, <No file>: line 1

PositionMessage : At C:\temp\td_snap\install\AppDeployToolkit\AppDeployToolkitMain.ps1:7476 char:36
                  +         If (Test-Path -LiteralPath $executeAsUserTempPath -PathType ' ...
                  +                                    ~~~~~~~~~~~~~~~~~~~~~~

The installation is running as SYSTEM so I want to try and call a function as the logged in user but if I can’t even launch Notepad.exe I am clearly doing something wrong. :smiley:

Thanks for an otherwise awesome toolkit, looking forward to learn and expand my knowledge of PSADT.

known issue: ExcecuteAsUser not working on 3.9.2 · Issue #749 · PSAppDeployToolkit/PSAppDeployToolkit (github.com)

Awesome! Did a quick search but could not find anything. Thanks!

Den fre 10 feb. 2023 17:47That-Annoying-Guy via PSAppDeployToolkit Community <notifications@psappdeploytoolkit.discoursemail.com> skrev: