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 yourpsftp
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).