I want to run an executable on a remote virtual machine. The executable is already on the remote virtual machine. The cmdlet I use is:
$command = "c:\users\<username>\desktop\Myexecutable.exe"
Invoke-Command -ComputerName Machine98 -ScriptBlock {$command} -Credential <domain_name>\<username>
I anonymized the <value>
but I am sure they are corrects.
At the command prompt of Powershell, there is no error message. And the prompt becomes accessible after the cmdlet, so it does not hang.
I am sure the service WS-Management is running and is correctly configured on the remote virtual machine because this cmdlet works:
enter-pssession -computername Machine98 -credential <domain_name>\<username>
Can you help me find what is wrong with my solution or propose another way of achieving things?