Post a reply

Options
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)

Options

Topic review

steph07

Error connexion : Connecting to FTP error

It's work, i exclude it
martin

Re: Error connexion : Connecting to FTP error

That's not WinSCP message. It must come from your server.
If you cannot upload that file, you need to exclude it from the synchronization.
steph07

Error connexion : Connecting to FTP error

Thank you Martin, it works now.

But sometimes, i have this error :

Error: Exception calling "Check" with "0" argument(s): "Error transferring file '/.ftpquota'.
Copying files from remote side failed.
Prohibited file name: .ftpquota"

I search to google this error "Prohibited file name: .ftpquota" but i didn't find anything.

Stéphane
martin

Re: Error connexion : Connecting to FTP error

To enable SSL/TLS, set SessionOptions.FtpSecure:
https://winscp.net/eng/docs/library_sessionoptions#ftpsecure

    $sessionOptions = New-Object WinSCP.SessionOptions -Property @{
        Protocol = [WinSCP.Protocol]::ftp
        HostName = "eportal-scheduled.services.xxxx.com"
        UserName = "eportal-ftp@anonyme.fr"
        Password = "xxxxxxxx*B"
        FtpSecure = [WinSCP.FtpSecure]::Explicit
    }

You might also need to set SessionOptions.TlsHostCertificateFingerprint.
steph07

Error connexion : Connecting to FTP error

Hello,

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