Post by rogercabo on Apr 2, 2023 1:29:35 GMT 1

This is getting pretty close to what you want I think:
' Setup session options
Dim sessionOptions
Set sessionOptions = WScript.CreateObject("WinSCP.SessionOptions")
With sessionOptions
.Protocol = Protocol_Sftp
.HostName = "example.com"
.UserName = "user"
.Password = "mypassword"
.SshHostKeyFingerprint = "ssh-rsa 2048 xxxxxxxxxxx..."
End With
Dim session
Set session = WScript.CreateObject("WinSCP.Session")
' Connect
session.Open sessionOptions
' Upload files
Dim transferOptions
Set transferOptions = WScript.CreateObject("WinSCP.TransferOptions")
transferOptions.TransferMode = TransferMode_Binary
Dim transferResult
Set transferResult = session.PutFiles("d:\toupload\*", "/home/user/", False, transferOptions)
' Throw on any error
transferResult.Check
' Print results
Dim transfer
For Each transfer In transferResult.Transfers
WScript.Echo "Upload of " & transfer.FileName & " succeeded"
Next
' Disconnect, clean up
session.Dispose
I tried to rework this code for GB32.. and registered with regsvr32.exe WinSCPnet.dll in my GB32 folder where all the other DLLs are.
But when try to register the following message occur:
"The module was loaded but the entry point DllRegisterServer was not found. Make sure that the DLL is a valid DLL or OCX file."
Further I use the new code:
Same problem here "OLE 499 Error" for sure.. Guys it's hard to create a SFTP connection by GB32.
But when try to register the following message occur:
"The module was loaded but the entry point DllRegisterServer was not found. Make sure that the DLL is a valid DLL or OCX file."
Further I use the new code:
Dim sessionOptionsWinSCP As Object
Set sessionOptionsWinSCP = CreateObject("WinSCP.SessionOptions")
With sessionOptionsWinSCP
.Protocol = 1 ' 1 steht für Protocol_Sftp
.HostName = "example.com"
.UserName = "user"
.Password = "mypassword"
.SshHostKeyFingerprint = "ssh-rsa256:xxxxxxxxxxx..."
End With
Dim sessionWinSCP As Object
Set sessionWinSCP = CreateObject("WinSCP.Session")
' Connect
sessionWinSCP.Open sessionOptionsWinSCP
Stop
Same problem here "OLE 499 Error" for sure.. Guys it's hard to create a SFTP connection by GB32.
