Exception calling "Open" with "1" argument(s): "Host "....com" does not exist

Advertisement

zairecrypto
Joined:
Posts:
1
Location:
Tallinn

Exception calling "Open" with "1" argument(s): "Host "....com" does not exist

Hello,

I am pretty new in WinSCP/PowerShell.

Im trying to connect to a FTP server using SshHostKeyFingerprint, all parameters are correct because I copied paste from a working WinSCP script.

But when I am trying a very basic $session.open, I'm getting the error message
Exception calling "Open" with "1" argument(s): "Host "....com" does not exist.
Not sure the problem comes from the hostname

Could you please help?

My script:
function test_connect{
    try {
        # Load WinSCP .NET assembly
        Add-Type -Path ".\WinSCP-5.17.10-Automation\WinSCPnet.dll"
 
        # Setup session options
        $sessionOptions = New-Object WinSCP.SessionOptions
        $sessionOptions.Protocol = [WinSCP.Protocol]::Sftp
        $sessionOptions.HostName = "sftp://xxxx@yyyyyyyy.com/"
        $sessionOptions.SshHostKeyFingerprint = "ssh-ed25519 256 3D....="        
   
        $session = New-Object WinSCP.Session
        try {
            # Connect
            $session.Open($sessionOptions)
        }
        finally {
            # Disconnect, clean up
            $session.Dispose()
        }
 
        # exit 0
    }
    catch {
        Write-Host "Error: $($_.Exception.Message)"
        # exit 1
    }
}

Reply with quote

Advertisement

Advertisement

You can post new topics in this forum