Run Powershell script as current user

Hello,

I currently have a problem that I want to run a powershell script in the PSADT. However, the program to be installed must be executed as Current User, otherwise it ends up in nowhere.

Execute-Process -Path “$PSHOME\powershell.exe” -Parameters “-file "$dirFiles\ForceInstall.ps1"” -Wait

This works, but clearly not as the current logged in User.

Hi,

Try using Execute-ProcessAsUser | PSAppDeployToolkit

1 Like

I would also advise you review your double quotes as the quoting around your command line may be at fault,
try:

Execute-Process -Path "$PSHOME\powershell.exe" -Parameters "-file `"$dirFiles\ForceInstall.ps1`"" -Wait

Note the escaped quotes around $dirFiles\ForceInstall.ps1

1 Like