Topic "powershell-Host key wasn't verified"

Author Message
Geroge

Guest


Dear all,

i use powershell to upload files to server. But it gives me error is: "Host key wasn't verified!".
however if I use the simple winscp script (with the host key), it works. anyone can help me to solve this problem?
thank you.

winscp 5.1.5

here is powershell script:

Code:

# Load WinSCP .NET assembly
# Use "winscp.dll" for the releases before the latest beta version.
[Reflection.Assembly]::LoadFrom("\\c:\WinSCP\WinSCP.dll") | Out-Null
# Setup session options
$sessionOptions = New-Object WinSCP.SessionOptions
$sessionOptions.Protocol = [WinSCP.Protocol]::SCP
$sessionOptions.HostName = "myhost"
$sessionOptions.UserName = "username"
$sessionOptions.Password = "password"
$sessionOptions.SshHostKeyFingerprint = "ssh-rsa 1023 xxxxxxxxxxxxxxxxxxxxxxxxxx"

$session = New-Object WinSCP.Session
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 25015
Location: Prague, Czechia
Please attach a complete session log file (set Session.SessionLogFile). Please note that public host key is not a secret information.
_________________
Martin Prikryl
Advertisements

You can post new topics in this forum






Search Site

What is WinSCP?

It is award-winning SFTP client, SCP client, FTPS client and FTP client integrated into one software program for file transfer to FTP server or secure SFTP server. [More]

And it's free!

Donate

About donations

$9   $19   $49   $99

About donations

Recommend

WinSCP Privacy Policy

WinSCP License