Closed gettalong closed 4 years ago
Yeah definitely looks like you hit a scenario where the error record parser cant handle the PSRP message its passed.
However an access denied will certainly produce an exception. It just needs to be parsed correctly so that the user gets a legible message. We probably just need to do a nil check on the Invocation Info and handle cases where that is empty.
To work around this, you might try ommiting the HOST
arg and just pass the script block since you are invoking the command on the same host.
Thanks for getting back and for the work around!
This appears to have been fixed in https://github.com/WinRb/WinRM/commit/d7ecaccdf956e998b8fc61d077cd9bdd44f8f898 . But the patch is not included in a release.
That commit is now released in v2.3.4
Thanks for developing this library!
I was just testing it whether it would be of use in our environment and found the following bug:
Given the following script:
The following Ruby error is thrown:
On investigating I found that
WinRM::PSRP::MessageData::ErrorRecord#doc
has the following value:It seems that the
ErrorRecord
class can't currently handle this kind of situation and raises an exception. However, even if the access is denied, it shouldn't result in an exception.