Topic "WinSCP.Session"

Author Message
AAS

Guest


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);
}
Advertisements
aas71
[View user's profile]

Joined: 2013-07-17
Posts: 1
Location: Netherlands Antilles
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
Guest




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
elk

Guest


Anyone solved this issue
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24553
Location: Prague, Czechia
Did you register the assembly for COM as per:
http://winscp.net/eng/docs/library_install#registering

Did you have another version of the assembly registered in the past?
_________________
Martin Prikryl
Advertisements

You can post new topics in this forum






Search Site

What is WinSCP?

It is award-winning SFTP client, SCP client, FTPS client and FTP client integrated into one software program for file transfer to FTP server or secure SFTP server. [More]

And it's free!

Donate

About donations

$9   $19   $49   $99

About donations

Recommend

WinSCP Privacy Policy

WinSCP License