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
But when I am trying a very basic
Could you please help?
My script:
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 Not sure the problem comes from the hostnameException calling "Open" with "1" argument(s): "Host "....com" does not exist.
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 } }