I've searched all over and tried different variations of commands, but I am still not there yet.
My goal is to run an exe that already resides on a remote machine and pass in command line arguments. I've tried invoke-command, but I can't seem to get my syntax to recognize the arguments.
Methods tried:
- Win32_Process.Create()
- Invoke-Command
- Start-Process
- [diagnostics.process]::start
- Invoke-WmiMethod
From my tests, the closest I can get is with the following command:
$command = "program.exe -r param"
Invoke-Command -ComputerName $server -ScriptBlock {$command}
The command completes without error or return code, but on the remote machine, it did not run with arguments. I've played around with single/double quotes to see if any change, but none.