Post a reply

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)


Topic review


Re: WebDAV not working via script but works via GUI

Hm I got expected "403 Forbidden", no TLS error, even on the first try.

What TLS version does CarotDAV use? Did you try TLS 1.2 with WinSCP?
What does first try mean exactly? The first try after some time? The first try after you start WinSCP?

"Got TLS closure" does not mean either.

Re: WebDAV not working via script but works via GUI

Many thanks for your support!

  • hostname is
  • I do not have access to target-server to look at the logs.
  • Other webdav clients succeed on first try

Tested with CarotDAV and Windows-feature "Webdav redirection",
which I combined to get most of the features of WinSCP I need.

When using WinSCP GUI, first time the screen "hangs" on "Connecting to host"
Finally resulting in Error "Connection failed".

Source-Server has < TLS1.2 disabled.
Handshake of commandline resulted in "Using TLSv1.3, cipher TLSv1.3: TLS_AES_256_GCM_SHA384," according to the log provided.

Does "ssl: Got TLS closure." in the log provided mean "succes" or "failure"?

Re: WebDAV not working via script but works via GUI

So do you get the same error in GUI? But on retry it works?
Does any WebDAV client work correctly (on the first try)? And with TLS 1.3?
Anything useful in server-side log file?
Can we have a full hostname of your server, so that we can try on our own?

WebDAV not working via script but works via GUI

Hi, I use WebDAV to download a database-backup from the cloud.
It did work previously, but after the last WinSCP download (and firewall-upgrade) it does not.
Using the GUI it does work, but never on the first try.
I did export the config and compared with my script and tries all sorts of syntaxes, no luck.
SET WINSCP="C:\Program Files (x86)\WinSCP\"
::  get location of this script
:: get script with same name in current folder
:: create log with same name in current folder
SET LOG="%CURLOC%%~n0.log"
:: target file
SET DBFILE="%CURLOC%SQLbackup\topdeskdatabaseNW.bak"
:: Remove old files and start download
IF EXIST %LOG% ( del %LOG%)
:: Download
%WINSCP% /script=%SCRIPT% /log=%LOG% /parameter // %DBFILE%
:: Replace File
IF EXIST %DBFILE% ( MOVE %DBFILE% "%CURLOC%SQLbackup\topdeskdatabase.bak")

#This opens a connection to TOPdesk
open "https://user:pass@***" -certificate=*
#Changes the working directory in SaaS to the database directory
cd /webdav/database_backup
#Changes the upload method (for performance)
option transfer binary
#Downloads the latest .bak file and rename it to topdeskdatabase.bak
# Please adjust the location (d:\databases\backup) and filename according to your database backup location and preffered database name.
### Databaselocation is passed as parameter from calling CMD ###
get -latest *.bak %1%
#close the connection
#Exits the WinSCP file

WinSCP Version 6.3.3 (Build 14916 2024-04-16) (OS 10.0.20348 – Windows Server 2022 Standard)

Configuration: HKCU\Software\Martin Prikryl\WinSCP 2\
Log level: Normal
Local account: RDGG\user
Working directory: D:\Scheduled_Scripts\Topdesk
Process ID: 7004
Ancestor processes: WinSCP, cmd, explorer, ...
Command-line: "C:\Program Files (x86)\WinSCP\WinSCP.exe" /console=6.3.3 /consoleinstance=_11652_420 "/script=D:\Scheduled_Scripts\Topdesk\WinSCP-DB-Downloadscript.txt" "/log=D:\Scheduled_Scripts\Topdesk\WinSCP-DB-Downloadscript.log" "/parameter" "//" "D:\Scheduled_Scripts\Topdesk\SQLbackup\topdeskdatabaseNW.bak"
Time zone: Current: GMT+2, Standard: GMT+1 (W. Europe Standard Time), DST: GMT+2 (W. Europe Daylight Time), DST Start: 31-3-2024, DST End: 27-10-2024
Login time: woensdag 24 april 2024 14:49:16
Script: Retrospectively logging previous script records:
Script: open https://***:***@*** -certificate=*
Session name: ***@*** (Ad-Hoc site)
Host name: *** (Port: 443)
User name: webdav (Password: Yes, Key file: No, Passphrase: No)
Transfer Protocol: WebDAV
Proxy: None
HTTPS: Yes [Client certificate: No]
WebDAV: Tolerate non-encoded: No
TLS/SSL versions: TLSv1.2-TLSv1.3
Local directory: default, Remote directory: /webdav/, Update: Yes, Cache: Yes
Cache directory changes: Yes, Permanent: Yes
Recycle bin: Delete to: No, Overwritten to: No, Bin path:
DST mode: Unix
Compression: No
Script: Connecting to host...
HTTP session to https://*** begins.
ssl: SNI enabled by default.
auth: Create for WWW-Authenticate
Sending request headers:
OPTIONS /webdav/ HTTP/1.1
 User-Agent: WinSCP/6.3.3 neon/0.33.0
 Connection: TE, Keep-Alive
 TE: trailers
 Host: ***
Sending request-line and headers:
Doing DNS lookup on ***
req: Connecting to
Doing SSL negotiation.
Identity match for '***': good
Verifying certificate for "" with fingerprint ***** and 08 failures
Certificate for "" matches cached fingerprint and failures
Using TLSv1.3, cipher TLSv1.3: TLS_AES_256_GCM_SHA384,
Request sent; retry is 0.
ssl: Got TLS closure.
Aborted request (-3): Could not read status line
sess: Closing connection.
ssl: Shutdown state: not sent | received.
ssl: Sending closure.
sess: Connection closed.
Request ends, status 0 class 0xx, error line:
Could not read status line: connection was closed by server
Request ends.
sess: Destroying session.
Script: Could not read status line: connection was closed by server
Connection failed.