Yes: _R_SPS is defined in my environment. The name is unusual intentionally in order to most probaly not conflict with other variables.
_R_SPS ist det to a certain directory and with $env:_R_SPS+"\"progs_common\PsExec64.exe I want to start PsEXEC64.exe stored in this directory. Most probably the problem is with the quoting (", ') of the parameters.
I use PSExec with SYSTEM-Permission (-s) in order to avoid UAC-problems and have a really silent installation .
I solved my problem in the meantime via:
with installpath: Path to Install-exe and app_Installationsparameter = " /S" for silent install (in this case 7-Zip).
The background of my efforts: I want to create an easy-to-use, costless, automatic (therfore the request for silent installation) und secure (controlled by me via malware-scans etc.) Choloatey/nuget-alternative for installation / updating apllications basd on a JSON-control-file.
But you need to run this script from an elevated PowerShell session anyway!? I’d recommend to make your code as simple as possible. The use of PsExec is very likely unnecessary.
For the vast majority of the tasks given you are not the very first one. You don’t have to re-invent the wheel again. Please use your prefered internet search engine and look for examples for tasks like this. There are frameworks out there specially made for this kind of tasks … for example …
Elevated is less then SYSTEM privilege: In order to avoid the UAC User Account Control inquiry on installation (real silent install) you need SYSTEM privilege. The onyl easy solution for this seems to be psexec(64).
Of cource I invested a lot of time in order to prohibit reinventing but on the other side gain trust in the solution. PowerShell App Deployment Toolkit (thanks for this hint) seems to be a great toolkit but needs a framework (for example for automatic and silent updates).
Michael
You don’t need. But it would make your life easier and reduce the chance for errors or vulnerabilities a lot.
But at the end of the day you’re a grown up individual. You don’t need to follow the recommendations from others. You can make your own decisions and your own mistakes.