cloudsoft / winrm4j

Apache License 2.0
93 stars 53 forks source link

How could I know whether the PS command is execute right or exactly #78

Closed GQsj closed 5 years ago

GQsj commented 6 years ago

Does the attribute "statusCode" in class "WinRmToolResponse" show the execute state? Can anyone tell me the meaning of the return number? Or I can only know the exec is right if the "stdout" has value, and if the "stdout" doesn't have value, the execute of the PS command is wrong?

Tuupertunut commented 6 years ago

I would imagine that it works the same way as exit codes in powershell commands, so statusCode 0 would mean successful execution and anything else would mean error.

aledsage commented 5 years ago

As @Tuupertunut said, the statusCode is the exit code in powershell commands.

There are some gotchas about these exit codes, and error handling, in winrm and powershell. There are some useful tips at https://docs.cloudsoft.io/blueprints/base-blueprints/winrm/index.html

I hope that answers your question - marking this issue as closed.