Post a reply

Before posting, please read how to report bug or request support effectively.

Bug reports without an attached log file are usually useless.

Add an Attachment

If you do not want to add an Attachment to your Post, please leave the Fields blank.

(maximum 10 MB; please compress large files; only common media, archive, text and programming file formats are allowed)


Topic review


kmkrause2 wrote:

Nevermind... I found the solution in a few other forum posts.


Here's the link to the forum post that helped me resolve the issue.

I used the registry method. My scheduled task was running under anohter AD account created just for services and scheduled tasks. I connected to the SFTP server using the GUI under my account, which logged the key from the server in the registry. I then copied the registry key mentioned in the link to the other accounts user area in the registry. I could have also logged into the server under the other account and used the GUI to connect. This would have also stored the server key in the registry.

Nevermind... I found the solution in a few other forum posts.


The Server's host key was not found in cache

WinSCP v. 4.3.2 build 1201
Windows Server Standard 2003 R2 SP2

When connecting to an SFTP server using the GUI Explorer interface, I can connect just fine. When I call an automated script from Windows Task Scheduler, I don't connect and the log file shows:

2011-09-27 15:06:04.479 If you trust this host, press Yes. To connect without adding host key to the cache, press No. To abandon the connection press Cancel.
. 2011-09-27 15:06:04.479
. 2011-09-27 15:06:04.479 Continue connecting and add host key to the cache? ()
. 2011-09-27 15:06:04.479 Attempt to close connection due to fatal exception:
* 2011-09-27 15:06:04.479 Host key wasn't verified!
. 2011-09-27 15:06:04.479 Closing connection.
. 2011-09-27 15:06:04.479 Sending special code: 12

My script file is:

@echo off
option batch on
option confirm off
open sftp://<username>:<password>@<host>.<domain>.com:228
cd /incoming
put d:\test file.txt

If I run the same script commands manually from a CLI, I can also connect and I never get propmted to accept the server key. How can I resolve this?