Error connexion : Connecting to FTP error
Hello,
I have a problem scripting.
this is the script :
I have the result :
Can you help
Best Regards
Stephane
I have a problem scripting.
this is the script :
# Specify directories $localPath = "C:\Temp\script" $remotePath = "/test" # Load WinSCP .NET assembly Add-Type -Path "C:\Program Files (x86)\WinSCP\WinSCPnet.dll" try { # Setup session options $sessionOptions = New-Object WinSCP.SessionOptions -Property @{ Protocol = [WinSCP.Protocol]::ftp HostName = "eportal-scheduled.services.xxxx.com" UserName = "eportal-ftp@anonyme.fr" Password = "xxxxxxxx*B" } $session = New-Object WinSCP.Session try { # Connect Write-Host "Connecting to FTP..." $session.Open($sessionOptions) # Download files $transferOptions = New-Object WinSCP.TransferOptions $transferOptions.TransferMode = [WinSCP.TransferMode]::Binary Write-Host "Synchronizing changes..." $transferResult = $session.SynchronizeDirectories( [WinSCP.SynchronizationMode]::Local, $localPath, $remotePath, $false. $transferOptions) # Throw on any error $transferResult.Check() # Print results foreach ($transfer in $transferResult.Downloads) { Write-Host "Download of $($transfer.FileName) succeeded" } } finally { # Disconnect, clean up $session.Dispose() } exit 0 } catch { Write-Host "Error: $($_.Exception.Message)" exit 1 }
I have the result :
Connecting to FTP... Error: Exception calling "Open" with "1" argument(s): "Connection failed. Connection failed. Sorry, cleartext sessions are not accepted on this server. Please reconnect using SSL/TLS security mechanisms."
Can you help
Best Regards
Stephane