I'm now using a shell script without any problems.
- oliver
FtpSecure.Explicit is 3, not 1.
Public Sub FTPupload(localFile As String, ftpserver As String, UserName As String, Password As String, remoteFile As String)
Dim session As Object
Dim sessionOptions As Object
' Create the WinSCP Session Options
Set session = CreateObject("WinSCP.Session")
Set sessionOptions = CreateObject("WinSCP.SessionOptions")
session.SessionLogPath = "C:\Temp\winscp_ftps.log"
With sessionOptions
.protocol = 2 '= FTPS
.HostName = ftpserver
.PortNumber = 21
.UserName = UserName
.Password = Password
.FtpMode = 1 ' Passive / Active
.FtpSecure = 1 ' Explicit TLS/SSL
.GiveUpSecurityAndAcceptAnyTlsHostCertificate = True
End With
session.Open sessionOptions
session.Dispose
End Sub
. 2025-05-05 12:19:26.433 --------------------------------------------------------------------------
. 2025-05-05 12:19:26.436 WinSCP Version 6.5 (Build 16288 2025-03-31) (OS 10.0.26100 – Windows 11 Pro)
. 2025-05-05 12:19:26.436 Configuration: nul
. 2025-05-05 12:19:26.436 Log level: Normal
. 2025-05-05 12:19:26.436 Local account: XXX
. 2025-05-05 12:19:26.436 Working directory: C:\Program Files (x86)\WinSCP
. 2025-05-05 12:19:26.436 Process ID: 2460
. 2025-05-05 12:19:26.453 Ancestor processes: MSACCESS, MSACCESS, explorer, ...
. 2025-05-05 12:19:26.454 Command-line: "C:\Program Files (x86)\WinSCP\winscp.exe" /xmllog="C:\Users\XX.XXX.000\AppData\Local\Temp\wscp2488.01F550A4.tmp" /xmlgroups /xmllogrequired /nointeractiveinput /stdout /stdin /dotnet=6.5.0 /ini=nul /log="C:\Temp\winscp_ftps.log" /console /consoleinstance=_9352_27252167_827
. 2025-05-05 12:19:26.460 Time zone: Current: GMT+2, Standard: GMT+1 (Mitteleuropäische Zeit), DST: GMT+2 (Mitteleuropäische Sommerzeit), DST Start: 30.03.2025, DST End: 26.10.2025
. 2025-05-05 12:19:26.460 Login time: Montag, 5. Mai 2025 12:19:26
. 2025-05-05 12:19:26.460 --------------------------------------------------------------------------
. 2025-05-05 12:19:26.460 Script: Retrospectively logging previous script records:
> 2025-05-05 12:19:26.460 Script: option batch on
< 2025-05-05 12:19:26.460 Script: batch on
< 2025-05-05 12:19:26.460 Script: reconnecttime 120
> 2025-05-05 12:19:26.460 Script: option confirm off
< 2025-05-05 12:19:26.460 Script: confirm off
> 2025-05-05 12:19:26.460 Script: option reconnecttime 120
< 2025-05-05 12:19:26.460 Script: reconnecttime 120
> 2025-05-05 12:19:26.460 Script: open ftp://int:***@ftp.XXX.de:21 -implicit -certificate="*" -passive=0 -timeout=15
. 2025-05-05 12:19:26.460 --------------------------------------------------------------------------
. 2025-05-05 12:19:26.460 Session name: int@ftp.XXX.de (Ad-Hoc site)
. 2025-05-05 12:19:26.460 Host name: ftp.XXX.de (Port: 21)
. 2025-05-05 12:19:26.460 User name: int (Password: Yes, Key file: No, Passphrase: No)
. 2025-05-05 12:19:26.460 Transfer Protocol: FTP
. 2025-05-05 12:19:26.460 Ping type: Dummy, Ping interval: 30 sec; Timeout: 15 sec
. 2025-05-05 12:19:26.460 Disable Nagle: No
. 2025-05-05 12:19:26.460 Proxy: None
. 2025-05-05 12:19:26.460 Send buffer: 262144
. 2025-05-05 12:19:26.460 UTF: Auto
. 2025-05-05 12:19:26.460 FTPS: Implicit TLS/SSL [Client certificate: No]
. 2025-05-05 12:19:26.460 FTP: Passive: No [Force IP: Auto]; MLSD: Auto [List all: Auto]; HOST: Auto
. 2025-05-05 12:19:26.460 Session reuse: Yes
. 2025-05-05 12:19:26.460 TLS/SSL versions: TLSv1.2-TLSv1.3
. 2025-05-05 12:19:26.460 Local directory: default, Remote directory: home, Update: Yes, Cache: Yes
. 2025-05-05 12:19:26.460 Cache directory changes: Yes, Permanent: Yes
. 2025-05-05 12:19:26.460 Recycle bin: Delete to: No, Overwritten to: No, Bin path:
. 2025-05-05 12:19:26.460 Timezone offset: 0h 0m
. 2025-05-05 12:19:26.460 --------------------------------------------------------------------------
< 2025-05-05 12:19:26.495 Script: Verbindung mit ftp.XXX.de wird hergestellt …
. 2025-05-05 12:19:26.495 Verbindung mit ftp.XXX.de wird hergestellt …
. 2025-05-05 12:19:26.509 Verbindung ist fehlgeschlagen.
< 2025-05-05 12:19:26.513 Script: Verbindung ist fehlgeschlagen.
< 2025-05-05 12:19:26.513 Verbindung ist fehlgeschlagen.
Protocol_Ftp:
Ftp), but it seemingly does not work.
FtpSecure = 1.
. 2025-05-01 07:32:07.363 Session name: XXX@ftp.XXXXX.de (Ad-Hoc site)
. 2025-05-01 07:32:07.363 Host name: ftp.XXXXX.de (Port: 21)
. 2025-05-01 07:32:07.363 User name: XXX (Password: Yes, Key file: No, Passphrase: No)
. 2025-05-01 07:32:07.363 Transfer Protocol: FTP
. 2025-05-01 07:32:07.363 Ping type: Dummy, Ping interval: 30 sec; Timeout: 15 sec
. 2025-05-01 07:32:07.363 Disable Nagle: No
. 2025-05-01 07:32:07.363 Proxy: None
. 2025-05-01 07:32:07.363 Send buffer: 262144
. 2025-05-01 07:32:07.363 UTF: Auto
. 2025-05-01 07:32:07.363 FTPS: Implicit TLS/SSL [Client certificate: No]
. 2025-05-01 07:32:07.364 FTP: Passive: No [Force IP: Auto]; MLSD: Auto [List all: Auto]; HOST: Auto
. 2025-05-01 07:32:07.364 Session reuse: Yes
. 2025-05-01 07:32:07.364 TLS/SSL versions: TLSv1.2-TLSv1.3
. 2025-05-01 07:32:07.364 Local directory: default, Remote directory: home, Update: Yes, Cache: Yes
. 2025-05-01 07:32:07.364 Cache directory changes: Yes, Permanent: Yes
. 2025-05-01 07:32:07.364 Recycle bin: Delete to: No, Overwritten to: No, Bin path:
. 2025-05-01 07:32:07.364 Timezone offset: 0h 0m
Protocol = 1 means SCP. For FTP, use 2.
Ftp than magic numbers.
Session.protocol is Protocol.Sftp od Protol.Scp, but SessionOptions.SshHostKeyFingerprint not set.
FTPSecure = implicit (although I have .FtpSecure = 1 in my code):
. 2025-04-29 13:15:30.111 FTPS: Implicit TLS/SSL [Client certificate: No]
Dim session As Object
Dim sessionOptions As Object
' Create the WinSCP Session Options
Set session = CreateObject("WinSCP.Session")
Set sessionOptions = CreateObject("WinSCP.SessionOptions")
session.SessionLogPath = "C:\Temp\winscp_ftps.log"
With sessionOptions
.protocol = 1 'FTPS
.HostName = ftpserver
.PortNumber = 21
.UserName = UserName
.Password = Password
.FtpMode = 1
.FtpSecure = 1 ' Explicit TLS/SSL
.GiveUpSecurityAndAcceptAnyTlsHostCertificate = True
End With
session.Open sessionOptions