Microsoft Virtualization Discussions

Invoke-NcSsh Does Not Close Putty

mcgue
5,559 Views

Using PowerShell Toolkit 4.6 and Putty 0.70.  Using the Invoke-NcSsh cmdlet.  Used the same cmdlet in the same script prior to upgrading the toolkit without issue.  The cmdlet functions; however, when the SSH data is returned, the SSH session is not closed and Putty remains open.  This creates a problem if calling Invoke-NcSsh multiple times in the same script.  Without it gracefully exiting you can get beyond the maximum SSH sessions on the cluster with an alert such as this:

 

 

xinetd.hit.per.source.limit: Maximum number of network connections of 32 received from the remote host x.x.x.x for the service ssh.

 

And then while calling the cmdlet in this condition you get this:

 

Invoke-NcSsh : Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index
At C:\Downloads\RiskResolverCertificate.ps1:306 char:34
+ $GetCertificateResults = Invoke-NcSsh $GetCertificateCommand
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidResult: (:) [Invoke-NcSsh], ArgumentOutOfRangeException
+ FullyQualifiedErrorId : SshExecFailed,DataONTAP.C.PowerShell.SDK.Cmdlets.Toolkit.Ssh.InvokeNcSsh

 

 

Is there a cmdlet that should be called to close the SSH session or a parameter to pass to ensure it is closed?

 

6 REPLIES 6

mbeattie
5,447 Views

Hi,

 

I think your issue might relate to BUG #1167414. A workaround would be to use "Invoke-NcSystemApi" instead of "Invoke-NcSsh" to avoid using Putty. I posted an example here:

 

https://community.netapp.com/t5/Microsoft-Cloud-and-Virtualization-Discussions/NetApp-PowerShell-Toolkit-4-5P1-released/td-p/138566/highlight/true/pag...

 

Hope that's useful

 

/Matt

If this post resolved your issue, help others by selecting ACCEPT AS SOLUTION or adding a KUDO.

mcgue
5,352 Views

Well that's a match, thanks for pointing it out.  I'll follow that BURT.  I don't think I can get what I need from the API but I'm going to try som ideas.  Thanks again.

Ananthag
4,790 Views

@mcgue 

I see that BUG 1167414 is not fixed.

Could you please suggest an alternative solution to overcome this BUG, if you have any

 

I'm using Powershell for storage automation, the PS script will communicate to NetApp (ONTAP Cloud Ver:9.3) to pull the snap list information. Since, the SSH sessions are not being closed after each query. I get the error  "Invoke-NcSsh : Index was out of range. Must be non-negative and less than the size of the collection".

 

I've to kill the SSH session for the query to work again.

 

Thank you 

Anantha

mcgue
4,768 Views

I'm checking with engineering, but I think this was fixed but just not updated in the bug report to reflect as such.  Are you getting the same issue even with the most current PowerShell toolkit?

Ananthag
4,742 Views

Thanks for the response.

I could fix the issue within the script by applying workaround commands.

Currently, I'm using the PowerShell toolkit version 4.4. Will install the latest PS Toolkit version to see if the issue is resolved.

Thank you

Anantha

Ananthag
4,699 Views

@mcgue 

I installed the latest NetApp's PowerShell tool kit (ver 9.6.0). I don't see multiple stale ssh connection after the query. But, it maintains one stale SSH connection always even after completion of the query.

 

The conclusion is that with the latest PS kit, issue is minimized but not resolved completely.

I'm good with the workaround that I found for this issue.

Thanks for the help 🙂

 

Public