Open michael-hay opened 8 years ago
Hello,
Yes, this is related with the previous issue. As we do not handle the return code of the process we cannot see if it finish if it does not return anything. That happens in your case because you are launching a command to a remote server.
I will see if I can do something similar to what I did in issue #8. I guess I could create a temp script for each command and append a return string to this script. In that case I will be able to guarantee that there is always an output.
A good test command for this is:
Invoke-Command -ComputerName serverName {(Get-Service serviceName).WaitForStatus('Running','02:00:00')}
Thx very much. These classes are quite useful.
Hi,
If you use the v1.7 you should have no problem. You only have to enable the remote mode.
Map<String, String> myConfig = new HashMap<>();
myConfig.put("remoteMode", "true");
response = powerShell.configure(myConfig).executeCommand("Invoke-Command -ComputerName serverName {(Get-Service serviceName).WaitForStatus('Running','02:00:00')}");
Best regards
Is there any situation where you wouldn't want to use remote mode?
If you run a command that does not return any output we will sit and poll expecting an output till we hit the timeout.