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.

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

martin

In scripting, you should always use the /ini=nul exactly for this reason.
https://winscp.net/eng/docs/scripting#configuration

In the session log file you can see if the host key was verified against the "cached" or the "configured" key.
Greg Munson

Thank-you....had been playing with quotes but it was originally giving a 'too many parameters' error - then the confusion was it finally "worked", even with those extra quotes, under my ID - falsity was that (apparently) it was using a key cached in the registry and not the key I was passing to it (unfortunately it never indicated that!?)...set /ini=nul and it started failing on my ID as well ....then was able to fix both with your correction to quotes.
Is there any way to see the indication that it checked the cached key 'under the covers' in case others encounter similar feature?
Thanks
martin

Re: SFTP SSH Hostkey match works but fails under SQL Agent Job

You have too many quotes there.

It should be:

open %1% -hostkey="%4%"

This works too (but the above is preferred):

open %1% "-hostkey=%4%"
Greg Munson

SFTP SSH Hostkey match works but fails under SQL Agent Job

Running WinSCP 5.7.7 on windows 2012 server, SQL 2014 standard and SSDT v12 under MS Visio Studio 2013;
Have an SSIS package using Execute Process task to launch Batch file which launches WinSCP to connect SFTP to server using ID:pwd and hostkey fingerprint validation. When running SSIS package from SSDT and/or SSMS under my ID- all good - see last seesion snipit in attached logfile; however when running same package (eg same batch file and winscp script) under SQL Server Agent Job schedule - it gives error that host key does not match - yet even in log printout the keys are the same (see first snipit in attached file). I'm guessing it's some hidden code page or undisplayable character translation bug? Any help or suggestions?
this is snip of winscp script file
Logfile content:
"%PROGRAMFILES(x86)%\WinSCP\WinSCP.com" /log=D:\Card_UCCE_CDW_Extract\Logfiles\winscplog.txt /loglevel=1 /script=D:\Card_UCCE_CDW_Extract\Program_Files\Hadoop_Connection.txt /parameter // %*

Winscp scipt file:
open %1% "-hostkey=""%4%"""
cd %3%
ls
put %2%
ls
exit
close