-
Notifications
You must be signed in to change notification settings - Fork 227
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Execution stops after a few New-SSHShellStreams #540
Comments
That is an interesting one. Against the hat type of device/server is this against?Sent from my iPhoneOn Aug 15, 2023, at 3:50 AM, sola-tron ***@***.***> wrote:
Hey there,
I got a weird issue with a script.
Using Posh-SSH 3.0.8, Powershell 5.1 and 7.3
I'm connecting like this
$Session = New-SSHSession -ComputerName $IP -Credential $Cred -AcceptKey -ErrorAction Stop
then I run a bunch of Invoke-SSHCommand and a Invoke-SSHShellStreamCommand
$stream = New-SSHShellStream -SSHSession $Session
$cli = Invoke-SSHStreamShellCommand -ShellStream $stream -Command "cli json"
followed by another StreamShellCommand to get the required info from the device.
Every New-SSHShellStream is within a separate function and is executed on every beginning of the function.
After X Shell-Streams it stops working (currently trying to find out after how many)
The Powershell session keeps running, but the script stops working. Ctrl+C has no effect, I have to kill the powershell session.
Example:
write-host "leases 1"
$stream = New-SSHShellStream -SSHSession $Session
write-host "leases stream: $stream"
$cli = Invoke-SSHStreamShellCommand -ShellStream $stream -Command "cli json"
write-host "leases cli: $cli"
write-host "leases stream: $stream"
is never reached when it happens
the same function worked earlier in the script without problems.
(when I change the order of the functions it also stops at other functions using New-SSHShellStream)
Surrounded by try-catch I don't get any errors, it just stops and I can wait forever.
When I disconnect the SSH-session and reconnect somewhere in the middle of all those calls the script works till the end.
How to avoid the reconnect, since I never really know when it happens?
Do I have to "close" the streams somehow? Is there something like a connection limit I can increase?
Any ideas on debugging this issue further?
Thanks in advance!
—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you are subscribed to this thread.Message ID: ***@***.***>
|
It's a Securepoint UTM Appliance. Connecting via SSH gives you access to the CLI, not a "real" root shell: My script was working fine till yesterday, where I added one more function with another New-SSHShellStream. After that I added the Disconnect & Connect right before the execution of the new function and it did work again |
the magical number seems to be 11 :D
this one runs forever:
The command I'm sending to the device in Invoke-SSHStreamShellCommand doesn't matter, tried various. This is also running till infinity:
|
Hey there,
I got a weird issue with a script.
Using Posh-SSH 3.0.8, Powershell 5.1 and 7.3
I'm connecting like this
$Session = New-SSHSession -ComputerName $IP -Credential $Cred -AcceptKey -ErrorAction Stop
then I run a bunch of Invoke-SSHCommand and a Invoke-SSHShellStreamCommand
followed by another StreamShellCommand to get the required info from the device.
Every New-SSHShellStream is within a separate function and is executed on every beginning of the function.
After X Shell-Streams it stops working (currently trying to find out after how many)
The Powershell session keeps running, but the script stops working. Ctrl+C has no effect, I have to kill the powershell session.
Example:
write-host "leases stream: $stream"
is never reached when it happens
the same function worked earlier in the script without problems.
(when I change the order of the functions it also stops at other functions using New-SSHShellStream)
Surrounded by try-catch I don't get any errors, it just stops and I can wait forever.
When I disconnect the SSH-session and reconnect somewhere in the middle of all those calls the script works till the end.
How to avoid the reconnect, since I never really know when it happens?
Do I have to "close" the streams somehow? Is there something like a connection limit I can increase?
Any ideas on debugging this issue further?
Thanks in advance!
The text was updated successfully, but these errors were encountered: