Data Infrastructure Management Software Discussions


PowerShell toolkit - Invoke-NcSSH private key file

Hi everyone,


We have an issue with the Invoke-NcSSH command.

It was working very well for months and suddenly, last friday, the command failed and required to install putty.


After putty installation done, the command request now to add the remote key into Putty's cache :

PS C:\Users\user> Invoke-ncssh -name $user -command $command -PrivateKeyFile "C:\keys\itsoper\wfa.key" -username $user
The server's host key is not cached in the registry. You
have no guarantee that the server is the computer you
think it is.
The server's xxx-sha2-nistp256 key fingerprint is:
xxx-sha2-nistp256 256 03:0d:3b:62:ae:6a:.........
If you trust this host, enter "y" to add the key to
PuTTY's cache and carry on connecting.
If you want to carry on connecting just once, without
adding the key to the cache, enter "n".
If you do not trust this host, press Return to abandon the
Store key in cache? (y/n)

We didn't find how to accept / ignore / bypass this output.


Any idea ?


Re: PowerShell toolkit - Invoke-NcSSH private key file


All my apologize if this question sounds stupid but... did you tried to press "y"  followed by enter ?
At this point, the cmdlet simply ask you if they key offered (by the remote host) should be trusted and added into the known_host file (locally).

Bests Regards,

Re: PowerShell toolkit - Invoke-NcSSH private key file



Have you considered using "Invoke-NcSystemApi" (HTTPS) as an alternative to "Invoke-NcSsh"? (SSH)

Here is an example:





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

Re: PowerShell toolkit - Invoke-NcSSH private key file

have you tried adding this to end of your command





Re: PowerShell toolkit - Invoke-NcSSH private key file

Same issue today. Unable to simply reply "y", the keyboard is locked. Only a Ctrl+C allow to go back to the prompt ...


I had a look in registry HKCU\Software\SimonTatham\PuTTY\SshHostKeys and entry exists for shortname as I was able to add it using Putty ...


Then I realized all the other Key are using IP addresses instead of shortname used with Connect-NcController ... Smiley Indifferent


I have renamed the REG key and all is working fine


That means, if this issue is occuring, a workaround can be to use Putty to connect the controller using the IP address instead of the name and accept the key ...