Exception calling "CreateShellStream" with "6" argument(s): "Failed to open a channel after 10 attempts."
Attempting to automate some HP switch config backups and recieve the above error when on this line:
$stream = $session.Session.CreateShellStream("dumb", 0, 0, 0, 0, 1000)
The switch is connected as the following output is seen:
Connected : True SessionId : 0 Host : 10.131.30.51 Session : Renci.SshNet.SshClient
The error is:
Exception calling "CreateShellStream" with "6" argument(s): "Failed to open a channel after 10 attempts." At line:148 char:13
-
$stream = $session.Session.CreateShellStream("dumb", 0, 0 ... -
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~- CategoryInfo : NotSpecified: (:) [], MethodInvocationException
- FullyQualifiedErrorId : SshException
I got the same trying to connect to cisco 2960 switch. Exactly the same error so I don't repeat it here
Can you test with this pre-release version https://github.com/darkoperator/Posh-SSH/releases/tag/3.1.3-Beta1
Can you test with this pre-release version https://github.com/darkoperator/Posh-SSH/releases/tag/3.1.3-Beta1
Same problem in 3.1.3
Against what type of device and what where the parameters of the commandSent from my iPhoneOn Jan 30, 2024, at 5:06 AM, Anton Yakovlev @.***> wrote:
Can you test with this pre-release version https://github.com/darkoperator/Posh-SSH/releases/tag/3.1.3-Beta1 Same problem in 3.1.3
—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you commented.Message ID: @.***>
Hi, I have the same problem with some HP and DCN Switches: If I try to create shell stream ($Stream = $Session.Session.CreateShellStream("dcn",0,0,0,0,100)) I get error: Exception calling "CreateShellStream" with "6" argument(s): "Failed to open a channel after 10 attempts." If I try to Inovke-Command (Invoke-SSHCommand -SSHSession $Session -Command $Input) I get error: Exception calling "BeginExecute" with "0" argument(s): "Failed to open a channel after 10 attempts."
Session is definietly connected, with this info: KeyExchangeAlgorithms : {[curve25519-sha256, Renci.SshNet.Security.KeyExchangeECCurve25519], [[email protected], Renci.SshNet.Security.KeyExchangeECCurve25519], [ecdh-sha2-nistp256, Renci.SshNet.Security.KeyExchangeECDH256 ], [ecdh-sha2-nistp384, Renci.SshNet.Security.KeyExchangeECDH384]...} Encryptions : {[aes128-ctr, Renci.SshNet.CipherInfo], [aes192-ctr, Renci.SshNet.CipherInfo], [aes256-ctr, Renci.SshNet.CipherInfo], [aes128-cbc, Renci.SshNet.CipherInfo]...} HmacAlgorithms : {[hmac-sha2-256, Renci.SshNet.HashInfo], [hmac-sha2-512, Renci.SshNet.HashInfo], [hmac-sha2-512-96, Renci.SshNet.HashInfo], [hmac-sha2-256-96, Renci.SshNet.HashInfo]...} HostKeyAlgorithms : {[ecdsa-sha2-nistp256, System.Func`2[System.Byte[],Renci.SshNet.Security.KeyHostAlgorithm]]} AuthenticationMethods : {password, keyboard-interactive} CompressionAlgorithms : {[none, ]} ChannelRequests : {[env, Renci.SshNet.Messages.Connection.EnvironmentVariableRequestInfo], [exec, Renci.SshNet.Messages.Connection.ExecRequestInfo], [exit-signal, Renci.SshNet.Messages.Connection.ExitSignalRequestInfo], [exit-s tatus, Renci.SshNet.Messages.Connection.ExitStatusRequestInfo]...} IsAuthenticated : True Host : 192.168.123.21 Port : 22 Username : admin ProxyType : None ProxyHost : ProxyPort : 0 ProxyUsername : ProxyPassword : Timeout : 01:00:00 ChannelCloseTimeout : 00:00:01 Encoding : System.Text.UTF8Encoding RetryAttempts : 10 MaxSessions : 10 CurrentKeyExchangeAlgorithm : curve25519-sha256 CurrentServerEncryption : aes128-ctr CurrentClientEncryption : aes128-ctr CurrentServerHmacAlgorithm : hmac-sha1 CurrentClientHmacAlgorithm : hmac-sha1 CurrentHostKeyAlgorithm : ecdsa-sha2-nistp256 CurrentServerCompressionAlgorithm : none ServerVersion : SSH-2.0-SERVER_1.01 ClientVersion : SSH-2.0-Renci.SshNet.SshClient.0.0.1 CurrentClientCompressionAlgorithm : none
Same script is working fine on Cisco switches.
My guess is that the HP device may use a menu and it is expecting a session large enough where it can display the menu. By having the display be a size of 0 it errors out.
OverloadDefinitions
-------------------
Renci.SshNet.ShellStream CreateShellStream(string terminalName, uint columns, uint rows, uint width, uint height, int bufferSize)
Renci.SshNet.ShellStream CreateShellStream(string terminalName, uint columns, uint rows, uint width, uint height, int bufferSize, System.Collections.Generic.IDictionary[Renci.SshNet.Common.TerminalModes,uint] terminalModeValues)