Philip_Baird
11 years agoCommunity Expert
WinSCP COM automation fails
Hi, I have registered the WinSCP library as per the instructions on the WinSCP site:
I have tried executing the following code to simply open and close a connection:
function testWinSCP() {
var session = Sys.OleObject("WinSCP.Session");
var sessionOptions = Sys.OleObject("WinSCP.SessionOptions");
sessionOptions.Protocol = session.Protocol_Sftp; // Not sure if correct
sessionOptions.HostName = "10.23.0.41";
sessionOptions.UserName = "oracle";
sessionOptions.Password = "Orac1e";
sessionOptions.SshHostKeyFingerprint = "ssh-rsa 2048 25:e2:6e:db:39:9e:50:e0:6f:57:7f:54:07:0a:a2:a1";
try {
session.Open(sessionOptions);
} catch( e ) {
Log.Message( e.message );
} finally {
session.Dispose();
}
};
but this fails with in an "Invalid procedure call or argument" Exception being thrown.
What else do I need to do to get this going? It doesn't help with the debugger not displaying any methods or properties of the objects.
I believe it is actually creating the objects as setting sessionOptions.SshHostKeyFingerprint to a string that does not match the pattern for ssh throws an Exception stating such.
Regards,
Phil Baird