Post a reply

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)


Topic review


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

The s is not a hostname. A hostname is The xxxxp goes to SessionOptions.UserName.
See also

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


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 $, I'm getting the error message
Exception calling "Open" with "1" argument(s): "Host "" 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 = "s"
        $sessionOptions.SshHostKeyFingerprint = "ssh-ed25519 256 3D....="       
        $session = New-Object WinSCP.Session
        try {
            # Connect
        finally {
            # Disconnect, clean up
        # exit 0
    catch {
        Write-Host "Error: $($_.Exception.Message)"
        # exit 1