JScript Fails Windows Server 2003
Hi,
I have had some problems setting up the envoriment on one of our servers running Windows Server 2003.
I have been following the guidelines on these sites (https://winscp.net/eng/docs/library_install)
It fails with this error message: Could not locate automation class named "WinSCP.SessionOptions".
Running from CMD with cscript test.wsf
WinSCP Is installed under C:\Apps\WinSCP, i have the .NET Assembly dll WinSCPnet.dll placed under the same folder.
The script is running from C:\Scripts. I have .Net Framework 3.5 Installed on the server
Other sample scripts are failing with the "WshShell.exec" object as source. I can run simple javascript code, but when i include your .NET Assembly to the code it fails.
What am i missing here?
I have had some problems setting up the envoriment on one of our servers running Windows Server 2003.
I have been following the guidelines on these sites (https://winscp.net/eng/docs/library_install)
<job> <reference object="WinSCP.Session" /> <script language="JScript"> try { // Setup session options var sessionOptions = WScript.CreateObject("WinSCP.SessionOptions"); sessionOptions.Protocol = Protocol_Sftp; sessionOptions.HostName = "example.com"; sessionOptions.UserName = "user"; sessionOptions.Password = "mypassword"; sessionOptions.SshHostKeyFingerprint = "ssh-rsa 1024 xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx"; 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("d:\\toupload\\*", "/home/user/", 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); } </script> </job>
It fails with this error message: Could not locate automation class named "WinSCP.SessionOptions".
Running from CMD with cscript test.wsf
WinSCP Is installed under C:\Apps\WinSCP, i have the .NET Assembly dll WinSCPnet.dll placed under the same folder.
The script is running from C:\Scripts. I have .Net Framework 3.5 Installed on the server
Other sample scripts are failing with the "WshShell.exec" object as source. I can run simple javascript code, but when i include your .NET Assembly to the code it fails.
What am i missing here?