Avatar of janhoedt
janhoedt
 asked on

PS, Winscp: "New-WinSCPSession : Exception calling "Open" with "1" argument(s): "SessionOptions.Protocol is Protocol.Sftp or Protocol.Scp, but SessionOptions.SshHostKeyFingerprint is not set."

Hi,

I'd like to use winscp but do not have a fingerprint. Yes, I know that's a security risk but not where I use it.

This is the tool https://gallery.technet.microsoft.com/WinSCP-PowerShell-Module-ee1601ff



How can I find a way around it?
J.
Powershell* SSH

Avatar of undefined
Last Comment
janhoedt

8/22/2022 - Mon
Dan McFadden

What protocol are you using, SFTP or SCP?  If SFTP, you can switch to just the FTP protocol and then no finger print is required.

Can you post the script throwing the error?

Dan
janhoedt

ASKER
Not sure, the default one, guess that's scp.
There is no error, it just asks for a fingerprint which I do not have.
ASKER CERTIFIED SOLUTION
Dan McFadden

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
janhoedt

ASKER
is wnscp ftp? (!)
This is the best money I have ever spent. I cannot not tell you how many times these folks have saved my bacon. I learn so much from the contributors.
rwheeler23
Dan McFadden

To quote the WinSCP website:


WinSCP is a popular SFTP client and FTP client for Microsoft Windows!
Copy file between a local computer and remote servers using
FTP, FTPS, SCP, SFTP, WebDAV or S3 file transfer protocols.

So yes, WinSCP can be used with several file transfer protocols, FTP being one of them.

Dan
janhoedt

ASKER
Apparently we use sftp, what is not working with the commands here.

$sessionOptions = New-Object WinSCP.SessionOptions -Property @{
        Protocol = [WinSCP.Protocol]::sFtp
        HostName = $ftpServer
        PortNumber = 22
        UserName = $userName
        Password = $passWord
}

Error is:
SessionOptions.Protocol is Protocol.Sftp or Protocol.Scp, but SessionOptions.SshHostKeyFingerprint is not set. (raised by: New-WinSCPSession)

New-WinSCPSession -SessionOption $sessionOptions