Post a reply

Options
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)

Options

Topic review

Porter

My script works fine when executed manually, but fails or hangs when run by Windows Scheduler

Awesome, that worked! thanks so much
martin

Re: My script works fine when executed manually, but fails or hangs when run by Windows Scheduler

The best solution is to use -hostkey switch in your open command.
https://winscp.net/eng/docs/scripting#hostkey
Porter

My script works fine when executed manually, but fails or hangs when run by Windows Scheduler

Hi There
I found that when i manually run a Batch file it ran up uploaded files.
If however Task scheduler ran it failed. Finally i added logging and got the below "**WARNING - POTENTIAL SECURITY BREACH!**. If I run the WinSCP program after clearing teh cache etc, i get the manually prompt but can't figure out who to get the script file to acknowledge this?

Error
. 2019-05-24 16:37:19.607 Host key does not match cached key
. 2019-05-24 16:37:19.607 Asking user:
. 2019-05-24 16:37:19.607 **WARNING - POTENTIAL SECURITY BREACH!**
. 2019-05-24 16:37:19.607
. 2019-05-24 16:37:19.607 The server's host key does not match the one WinSCP has in cache. This means that either the server administrator has changed the host key, the server presents different key under certain circumstance, or you have actually connected to another computer pretending to be the server.
. 2019-05-24 16:37:19.607
. 2019-05-24 16:37:19.607 The new RSA key details are:
. 2019-05-24 16:37:19.607
. 2019-05-24 16:37:19.607 Algorithm: ssh-rsa 2048
. 2019-05-24 16:37:19.607 SHA-256: XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
. 2019-05-24 16:37:19.607 MD5: XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
. 2019-05-24 16:37:19.607
. 2019-05-24 16:37:19.607 If you were expecting this change, trust the new key and want to continue connecting to the server, either press Update to update cache, or press Add to add the new key to the cache while keeping the old one(s). If you want to carry on connecting but without updating the cache, press Skip. If you want to abandon the connection completely, press Cancel. Pressing Cancel is the ONLY guaranteed safe choice.
. 2019-05-24 16:37:19.607 In scripting, you should use a -hostkey switch to configure the expected host key. ()
. 2019-05-24 16:37:29.850 Attempt to close connection due to fatal exception:
* 2019-05-24 16:37:29.850 Host key fingerprint is ssh-rsa 2048 cERM0TgLxRaqxzqPLAtKT6pqceGpSmLCDMDtdn21FN8=.
* 2019-05-24 16:37:29.850 (Exception) **Host key wasn't verified!**
. 2019-05-24 16:37:29.850 Closing connection.
. 2019-05-24 16:37:29.850 Sending special code: 12


Any idea's please