WinSCP.Session

Advertisement

AAS
Guest

WinSCP.Session

Hi I'm new to scripting with WinSCP.
I used the following script (script starts after error message) to connect to our FTP server. I removed the sessionOptions values for security reasons. But when I run the script I get the following message:


---------------------------
Windows Script Host
---------------------------
Script: C:\Users\asulbaran\Documents\WinSCPCISS.wsf
Line: 3
Char: 21
Error: Cannot find the type library for this reference : WinSCP.Session
Code: 80040068
Source: Windows Script Host

---------------------------
OK
---------------------------

<job>
<reference object="WinSCP.Session" />
<script language="JScript">

try
{
// Setup session options
var sessionOptions = WScript.CreateObject("WinSCP.SessionOptions");
sessionOptions.Protocol = Protocol_Sftp;
sessionOptions.HostName = "";
sessionOptions.UserName = "";
sessionOptions.Password = "";
sessionOptions.SshHostKeyFingerprint = "";

var session = WScript.CreateObject("WinSCP.Session");

try
{
// Connect
session.Open(sessionOptions);

// Upload files
var transferOptions = WScript.CreateObject("WinSCP.TransferOptions");
transferOptions.TransferMode = TransferMode_Binary;

var transferResult = session.PutFiles("C:\\Users\\asulbaran\Documents\\desktop.ini", "/BBRB", false, transferOptions);

// Throw on any error
transferResult.Check();

// Print results
for (var enumerator = new Enumerator(transferResult.Transfers); !enumerator.atEnd(); enumerator.moveNext())
{
WScript.Echo("Upload of " + enumerator.item().FileName + " succeeded");
}
}
finally
{
// Disconnect, clean up
session.Dispose();
}
}
catch (e)
{
WScript.Echo("Error: " + e.message);
WScript.Quit(1);
}

Reply with quote

Advertisement

aas71
Joined:
Posts:
1
Location:
Netherlands Antilles

Error: Could not create object named "WinSCP.SessionOptions"

I overlooked the installation readme file of the command-line tool. But after registering the dll file I get another error:
Error: Could not create object named "WinSCP.SessionOptions".

Please help

Reply with quote

Guest

Re: Error: Could not create object named "WinSCP.SessionOptions"

aas71 wrote:

I overlooked the installation readme file of the command-line tool. But after registering the dll file I get another error:
Error: Could not create object named "WinSCP.SessionOptions".

Please help

Hi

Did you solve this as I have the issue now

Reply with quote

Advertisement

You can post new topics in this forum