Secure in SessionOptions is set to "False" for S3 connections in WinSCP 6.1.1
In the documentation (https://winscp.net/eng/docs/library_sessionoptions) it says that the
The script is made in PowerShell and run on PowerShell 7.3.3 on a Windows Server 2016. It was working fine (default=
Here is the script:
A session log is attached (log is for WinSCP 6.1.2).
Secure
option in SessionOptions
is by default True
for S3, however when I try to transfer a file to a S3 server its actually False
by default and has to be set to True
.
The script is made in PowerShell and run on PowerShell 7.3.3 on a Windows Server 2016. It was working fine (default=
True
) until WinSCP 5.21.3 (Build 12800 2022-09-06). When updated to WinSCP 6.1.1 it was changed to False
.
Here is the script:
# Path to WinSCP DLL $global:winscpPath = "C:\MFT\WinSCPnet.dll" # Load WinSCP .NET assembly Add-Type -Path "C:\MFT\WinSCPnet.dll" # Set up session options $sessionOptions = New-Object WinSCP.SessionOptions -Property @{ Protocol = [WinSCP.Protocol]::S3 HostName = "s3.eu-west-1.amazonaws.com" UserName = "*************" Password = "*************" } $session = New-Object WinSCP.Session $session.SessionLogPath = "C:\MFT\Integrations\MFT000\aws_test_log.log" $transferOptions = New-Object WinSCP.TransferOptions $transferOptions.TransferMode = [WinSCP.TransferMode]::Binary # As some servers does not support updating timestamps of remote files. $transferOptions.PreserveTimestamp = $False $sessionOptions.AddRawSettings("S3DefaultRegion", "eu-west-1") try { # Connect $session.Open($sessionOptions) # Your code $session.PutFiles("C:\Files\*", "/datalakeraw/", $False, $transferOptions) } finally { $session.Dispose() }
A session log is attached (log is for WinSCP 6.1.2).