PSExec with Start-Process?

by Aug 31, 2017

Good Afternoon,

We do not have Powershell remoting enabled for our enterprise and so I resorted to using psexec to install some software remotely.

If I run the following it works:

$Executable = IE.exe

$Arguments = /quiet

Start-Process -Wait -PSPath C:PsExec.exe -ArgumentList "\Test C:$Executable $Arguments"

However if I run it like this:

Start-Process -Wait -PSPath C:PsExec.exe -ArgumentList "\Test C:IE.exe /quiet"

It does not work, I believe this is because 'Start-Process' and 'PsExec.exe' interpret the argument list differently?  Please could someone explain why putting the executable and arguments in a Powershell variable works but putting them as a literal string in the command does not?