I have a project where i shall transfer files to a FTP server. To this, I have tried to use WinSCP with the .NET assembly/ Com library.
Using VBscript :oops:
I have tested with following downloaded installations:
winscp514automation.zip/winscp514setup.exe (calling returns that winscp.dll is incompatible, so tested older versions as well):
I have registered Winscp.dll using:
call "%WINDIR%\Microsoft.NET\Framework64\%NETVersion%\RegAsm.exe" "WinSCP.dll" /codebase /tlb
Where WinSCP is copied to %ProgramFiles(x86)%\WinSCP and above call is executed in this directory.
I use the example as provided here: https://winscp.net/eng/docs/library_com_wsh#vbscript, with the following modifications:
.FtpMode = Passive
.Protocol = Protocol_Ftp
.HostName = "example.com"
.UserName = "user"
.Password = "mypassword"
(Hostname, Username and Password is changed for my environment in my code)
However, on all my computers this fails with:
WinSCP: SessionOptions.Protocol is Protocol.Sftp or Protocol.Scp, but SessionOptions.HostKey is not set.
...and if I provide SessionOptions.HostKey:
WinSCP: SSH host key fingerprint "ssh-rsa1024 xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx" does not match pattern .. blah blah.
A SSH key should not be needed for FTP anyhow, so.....
Any tips on what I do wrong?