psftp says "The server's host key is not cached in the registry" psftp says "The server's host key is not cached in the registry" powershell powershell

psftp says "The server's host key is not cached in the registry"


That message is not an error.

Every SSH/SFTP client needs to verify a host key of a server.

Even PuTTY and WinSCP asked you for sure on your first connection to the server to verify a host key.

Though PuTTY and psftp share a host key cache. Are you sure you used PuTTY on the same machine with the same local Windows account?

Anyway, either:

  • Run psftp once without the -batch switch. Check the host key and confirm if you trust it. psftp will cache the host key and will work from now on.
  • Or add -hostkey switch with a fingerprint of trusted hostkey to your psftp command in PowerShell script.

See also How to pass value to psftp prompt (though the higher-scored answer by @vmitchell85 is wrong, see the answer by @GerriePretorius).