Hi all,
I want to run a utility (exe) with parameters on a remote machine (server). The utility has to run on the server because of its architecture (local installation/database etc.).
I tried to do this with invoke-command. When I run invoke-command within a pssession, it works. When I run invoke-command with the -computername parameter, I do not get any result. In the PowerShell eventlog, I can see the command executes the way I want it, but nothing happens.
I’m assuming the exe runs interactively, but not without interaction. Is there any way to troubleshoot this, and find out what is causing the exe to fail? Or, are there any other methods I can use to run exe’s remotely? What is the difference between using invoke-command within a remoting session and using invoke-command with the computername parameter?
Extra information:
I use the following command:
Invoke-Command -ComputerName MyServer -ArgumentList arg1,arg2 -ScriptBlock {param(arg1,arg2);Start-Process -FilePath ‘D:\Program Files\MyApp\MyExe.exe’ -ArgumentList “arg1 arg2” -WorkingDirectory ‘D:\Program Files\MyApp\MyExe.exe’ -RedirectStandardOutput ‘D:\Logs\Out.log’ -RedirectStandardError ‘D:\Logs\Error.log’}
The above command works perfectly when I first start a pssession and run the command without the -ComputerName parameter.
I have a backup plan, being the task scheduler, but I would rather do it with PowerShell.
Any ideas?
Thanks in advance!