I'm pushing out a 'head' command on some remote files via SSH using Invoke-SSHCommand. Once in a while one or two of these files I'm heading will just hang indefinitely on the command. I can actually reproduce that behavior on those particular files manually and that's not the issue. The issue is that even when Invoke-SSHCommand times out, control never returns to my script and everything hangs indefinitely. In fact, I can't even CTRL-C the script and have to close the session entirely.
Error returned:
Exception calling "EndExecute" with "1" argument(s): "Command 'head -n 10 "/path/to/file"' has timed out."
At C:\Program Files\WindowsPowerShell\Modules\Posh-SSH\3.2.4\Posh-SSH.psm1:294 char:25
+ $Output = $_.cmd.EndExecute($_.Async)
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException
+ FullyQualifiedErrorId : SshOperationTimeoutException
Wanted to post the issue here before I started trying to muck around in your code in case you have any idea.
Any help is appreciated and also want to add that this is a great module that I get a lot of mileage out of and really appreciate the work.
Thanks!
I'm pushing out a 'head' command on some remote files via SSH using Invoke-SSHCommand. Once in a while one or two of these files I'm heading will just hang indefinitely on the command. I can actually reproduce that behavior on those particular files manually and that's not the issue. The issue is that even when Invoke-SSHCommand times out, control never returns to my script and everything hangs indefinitely. In fact, I can't even CTRL-C the script and have to close the session entirely.
Error returned:
Wanted to post the issue here before I started trying to muck around in your code in case you have any idea.
Any help is appreciated and also want to add that this is a great module that I get a lot of mileage out of and really appreciate the work.
Thanks!