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

martin

Re: Incompatible external console protocol version 9

I do not think you can get "Incompatible external console protocol version 9" error with your current code. Aren't you actually setting DisableVersionCheck property?

Anyway, you still have some binary outdated.
You are not very specific regarding the folders, where you replaced the binaries. So it is difficult to help you.

Anyway, extracting the WinSCP-6.3.1-Automation.zip package to C:\Program Files\Zammad-Backup-Downloader should help.

If it does not work, please post debug log file (Session.DebugLogPath).
SteHRfan

Incompatible external console protocol version 9

Hello,

we make an automated backup from our ticket system witch following skript:
param (
    $localPath = "C:\Backups",
    $remotePath = "/export"
)
try
{
    # Load WinSCP .NET assembly
    Add-Type -Path "C:\Program Files\Zammad-Backup-Downloader\WinSCPnet.dll"
    # Setup session options
    $sessionOptions = New-Object WinSCP.SessionOptions -Property @{
        Protocol = [WinSCP.Protocol]::Sftp
        HostName = "here.there.com"
        UserName = "abcdefgh"
        SshHostKeyFingerprint = "ssh-ed25519 255 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" (is changed)
        SshPrivateKeyPath = "C:\SSH\private.ppk"
    }
    $session = New-Object WinSCP.Session
    try
    {
        # Connect
        $session.Open($sessionOptions)
        # Get list of files in the directory
        $directoryInfo = $session.ListDirectory($remotePath)
        # Select the most recent file
        $latest =
            $directoryInfo.Files |
            Where-Object { -Not $_.IsDirectory } |
            Sort-Object LastWriteTime -Descending |
            Select-Object -First 1
        # Any file at all?
        if ($latest -eq $Null)
        {
            Write-Host "No file found"
            exit 1
        }
        # Download the selected file
        $session.GetFileToDirectory($latest.FullName, $localPath) | Out-Null
    }
    finally
    {
        # Disconnect, clean up
        $session.Dispose()
    }
    exit 0
}
catch
{
    Write-Host "Error: $($_.Exception.Message)"
    exit 1
}

This works some years with WinSCP V5.The ticket system support told me that I have to change to the newer version of WinSCP. So I downloaded the WinSCP-6.3.1-Portable.zip an put them to the folder where the old version was stored.
With that I got the Error
Zammad-Backup-Downloader\Download-Zammad-Backup.ps1
Error: Ausnahme beim Aufrufen von "Open" mit 1 Argument(en): "The version of C:\Program Files\Backup\winscp.exe (6.3.1.0) does not match version of this assembly C:\Program Files\Backup\WinSCPnet.dll (5.17.10.0).

So I downloaded the WinSCP-6.3.1-Automation.zip and saved the files in that folder.
Now I got the following error:
Incompatible external console protocol version 9.

What I have to change?

Best regards