Microsoft Virtualization Discussions

Invoke-NcSsh Does Not Close Putty

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: (Smiley Happy [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?

 

2 REPLIES

Re: Invoke-NcSsh Does Not Close Putty

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.

Re: Invoke-NcSsh Does Not Close Putty

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.

Forums