tomohulk / WinSCP

WinSCP PowerShell Wrapper Module
GNU General Public License v3.0
151 stars 29 forks source link

error if I try to connect to an S3. #158

Closed flaajimi closed 8 months ago

flaajimi commented 8 months ago

I get an error if I try to connect to an S3 :

is it possible to help me? Thank's

New-WinSCPSession : Exception lors de l'appel de « Open » avec « 1 » argument(s) : « Could not read status line: Secure connection truncated
Connection failed. »
Au caractère Ligne:22 : 18
+ ... CPSession = New-WinSCPSession -SessionOption ($WinSCPSessionOption) - ...
+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [New-WinSCPSession], MethodInvocationException
    + FullyQualifiedErrorId : SessionRemoteException,New-WinSCPSession

my code :

$credential = New-Object System.Management.Automation.PSCredential($S3_User, $S3_Password_Convert)

$WinSCPSessionOption = New-WinSCPSessionOption -Hostname $S3_Serveur -Protocol S3 -PortNumber $S3_Port -Credential $credential -TlsHostCertificateFingerprint "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" -Verbose

$WinSCPSessionOption.RootPath = "/" 
$WinSCPSessionOption.Secure = $true

$WinSCPSession = New-WinSCPSession -SessionOption ($WinSCPSessionOption) -SessionLogPath "C:\Session.log" -DebugLogPath "C:\Debug.log" -Verbose -DebugLogLevel 2

$Session = Get-WinSCPSession -WinSCPSession $WinSCPSession

if ($Session.Opened -eq $true) {
    Write-Host "Acces S3 sur le serveur : OK"
} else {
    Write-Host "Acces S3 sur le serveur : KO"
}
flaajimi commented 8 months ago

Someone can help me ! Thanks a lot

tomohulk commented 8 months ago

This looks like an issue with the server response, this project is a just a WinSCP PowerShell wrapper, so not a lot of help i can offer there. can you connect to it with the WinSCP GUI application?

Also, just a side note in your code snippit, the like $Session = Get-WinSCPSession -WinSCPSession $WinSCPSession is redundant, the value of $Session is the same as the value of what is already in $WinSCPSession.

flaajimi commented 8 months ago

Hello, Same error message with WinSCP GUI

flaajimi commented 8 months ago

Problème serveur