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?