I created a stored session using the WinSCP gui.
Then I created a dos batch file that opens my connection using the stored session.
My files gets uploaded and everything works perfectly.
Now I created a SQL Stored Procedure that will run on a schedule and will make
use of my WinSCP batch file to SFTP files to the client site.
I get the following message in my log when executing the batch file :
Looking up host "email@example.com"
Connecting to 18.104.22.168 port 22
Server version: SSH-2.0-SSHD
We believe remote version has SSH-2 ignore bug
Using SSH protocol version 2
We claim version: SSH-2.0-WinSCP_release_4.3.4
Doing Diffie-Hellman group exchange
Doing Diffie-Hellman key exchange with hash SHA-1
The server's host key was not found in the cache. You have no guarantee that the server is the computer you think it is.
The server's rsa2 key fingerprint is:
ssh-rsa 1024 xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx
If you trust this host, press Yes. To connect without adding host key to the cache, press No. To abandon the connection press Cancel.
Continue connecting and add host key to the cache? ()
Attempt to close connection due to fatal exception:
Host key wasn't verified!
Sending special code: 12
But when I fire that exact same batch file - it works perfectly ?
Why on earth would my stored session work in the batch file - but not when that exact batch file is fired from SQL ?
I tried to add my hostkey to my batch file - but failed on syntax.
My working batch file currently :
"C:\Program Files (x86)WinSCP\WinScp.exe"
/command "option batch on" "option confirm off"
"open firstname.lastname@example.org" --this is my stored session that works perfectly
"put %1" --this is a parameter (file name) passed to my batch file
echo %errorlevel% --I get my result here - usually a 0 when .bat is fired and a
--1 when fired from SQL.
Any ideas why this would be happening to me?
Thanks in advance.