I'm trying to run an exe on a remote computer using powershell without success. when I run locally on the server like so it is running successfully
"C:\Program Files\Syncovery\Syncovery.exe" /RUNX="myJobName" /S
I've tried several ways running this remotely, but im getting all sorts of errors
$exe = "C:\Program Files\Syncovery\Syncovery.exe"
$arguments = '/RUNX="myJobName" /S'
$proc = [Diagnostics.Process]::Start($exe, $arguments)
$proc.WaitForExit()
or
Invoke-Command -ComputerName serverName -ScriptBlock {$proc.WaitForExit()}
*Error: Exception calling "Start" with "2" argument(s): "The system cannot find the file specified" At line:3 char:1
- $proc = [Diagnostics.Process]::Start($exe, $arguments)*
or
Invoke-Command -ComputerName serverName -ScriptBlock {&$exe $arguments}
Error: the expression after '&' in a pipeline element produced an object that was not valid. It must result in a command name, a script block, or a CommandInfo object.