Post a reply

Before posting, please read how to report bug or request support effectively.

Bug reports without an attached log file are usually useless.

Options
Add an Attachment

If you do not want to add an Attachment to your Post, please leave the Fields blank.

(maximum 10 MB; please compress large files; only common media, archive, text and programming file formats are allowed)

Options

Topic review

martin

Re: Issue with VBSCRIPT

Anonymous wrote:

Good evening.
I'm not able to use wsf because i've this error :


Version of C:\INTERF\jobs\Scripts\winscp\winscp.exe is 5.1.6.3394, product WinSCP version is 5.1.6.0
[2015-05-06 22:11:46.299Z] [0001] Exception: WinSCP.SessionLocalException: The version of C:\INTERF\jobs\Scripts\winscp\winscp.exe (5.1.6.0) does not match version of this assembly C:\INTERF\jobs\Scripts\winscp\WinSCPnet.DLL (5.7.1.0). You can disable this check using Session.DisableVersionCheck (not recommended).

So why don't you get same version of both files?
Guest

Re: Issue with VBSCRIPT

Good evening.
I'm not able to use wsf because i've this error :


Version of C:\INTERF\jobs\Scripts\winscp\winscp.exe is 5.1.6.3394, product WinSCP version is 5.1.6.0
[2015-05-06 22:11:46.299Z] [0001] Exception: WinSCP.SessionLocalException: The version of C:\INTERF\jobs\Scripts\winscp\winscp.exe (5.1.6.0) does not match version of this assembly C:\INTERF\jobs\Scripts\winscp\WinSCPnet.DLL (5.7.1.0). You can disable this check using Session.DisableVersionCheck (not recommended).

I tried with

session.DisableVersionCheck = true

without success :-(
Guest

Re: Issue with VBSCRIPT

Many Thanks !!!
It works.

Can I ask you another information about session.MoveFile ?
Is it possibile to move files from remote path to another remote path (for example from /temp to /test) ? Both paths are on the same FTP site.
martin

Re: Issue with VBSCRIPT

Only now I noticed that you declare these variables:
Dim ..., FtpSecure, TlsHostCertificateFingerprint, Explicit, Protocol_ftp

They obviously shadow the constants/symbols from WinSCP .NET assembly. You have to remove that declaration.
Guest

Re: Issue with VBSCRIPT

Good Evening,
sorry to bother you.

Do you have some new about my issue ?

Thanks in advance
Guest

Re: Issue with VBSCRIPT

In attachment
martin

Re: Issue with VBSCRIPT

Please attach a full session and debug log files showing the problem (using the latest version of WinSCP).

Set Session.SessionLogPath and Session.DebugLogPath. If you do not want to post the logs publicly, you can mark the attachments as private.


Also attach your complete WSF file.
Guest

Re: Issue with VBSCRIPT

Good Morning,
yes but i've the same error.
Gianluca_Italy

Issue with VBSCRIPT

Good Morning.
I'm trying to automate a connection with FTP site (SSL Explicit enc).

Here below my code

Option Explicit

' Setup session options
Dim sessionOptions, FtpSecure, TlsHostCertificateFingerprint, Explicit, Protocol_ftp
Set sessionOptions = WScript.CreateObject("WinSCP.SessionOptions")
With sessionOptions
.Protocol = Protocol_ftp
.FtpSecure = Explicit
.HostName = "xxxxxx"
.UserName = "xxxxxx"
.Password = "xxxxxx"
End With


Dim session
Set session = WScript.CreateObject("WinSCP.Session")
session.SessionLogPath = "C:\TEMP\TestSessionLog.txt"
session.DebugLogPath = "C:\TEMP\TestDebugLog.txt"


' Connect
session.Open SessionOptions
Const ForReading = 1
Dim fileName, fileName2, remotePath, remotePath2, localPath
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objDictionary = CreateObject("Scripting.Dictionary")
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.OpenTextFile("C:\TEMP\RBC LBX NEXT SEQUENCE.ini", ForReading)


i = 0
Do Until objFile.AtEndOfStream
strNextLine = objFile.Readline
If strNextLine <> "" Then
'fileName = "LBXACN." & strNextLine
'fileName2 = "LBXACN." & strNextLine & ".downloaded%FTPS"
fileName = "pippo"
fileName = "pippo2"
End If
Loop
objFile.Close

'remotePath = "/outbound/HVHV" & fileName
'remotePath2 = "/outbound/HVHV" & fileName2
remotePath = fileName
remotePath2 = fileName2
localPath = "C:\INTERF\UCQ\RBC\LOCKBOX" & fileName

Dim fs
Set fs = WScript.CreateObject("Scripting.FileSystemObject")

Dim download, remoteWriteTime, localWriteTime

If session.FileExists(remotePath) Then
' Download the file and throw on any error
session.GetFiles(remotePath, localPath).Check()
WScript.Echo "Download to C:\INTERF\UCQ\RBC\LOCKBOX\ done."
Else
WScript.Echo "File " & remotePath & " does not exist yet"
End If

If session.FileExists(remotePath2) Then
' Download the file and throw on any error
session.GetFiles(remotePath2, localPath).Check()

WScript.Echo "Download to C:\INTERF\UCQ\RBC\LOCKBOX\ done."
Else
WScript.Echo "File " & remotePath2 & " does not exist yet"
End If

' Disconnect, clean up
session.Dispose

The error is
Executing Assembly: WinSCPnet, Version=1.2.7.5235, Culture=neutral, PublicKeyToken=2271ec4a3c56d0bf; Path: C:\Windows\Microsoft.NET\Framework64\v4.0.30319\WinSCPnet.DLL; Location: C:\Windows\Microsoft.NET\Framework64\v4.0.30319\WinSCPnet.dll; Product: 5.7.1.0

Exception: System.ArgumentException: SessionOptions.Protocol is Protocol.Sftp or Protocol.Scp, but SessionOptions.HostKey is not set.
in WinSCP.Session.SessionOptionsToOpenSwitches(SessionOptions sessionOptions)
in WinSCP.Session.SessionOptionsToOpenCommand(SessionOptions sessionOptions, String& command, String& log)
in WinSCP.Session.Open(SessionOptions sessionOptions)


Thanks in advance for your support.