Property 'GiveUpSecurityAndAcceptAnySshHostKey'

Advertisement

bab5470
Joined:
Posts:
1

Property 'GiveUpSecurityAndAcceptAnySshHostKey'

I have the following powershell code using the winscp .net assembly:

# Load WinSCP .NET assembly
[Reflection.Assembly]::LoadFrom("C:/tools/WinSCPnet.dll") | Out-Null

# Setup session options
$sessionOptions = New-Object WinSCP.SessionOptions
$sessionOptions.Protocol = [WinSCP.Protocol]::Sftp
$sessionOptions.HostName = "myserver.domain.local"
$sessionOptions.UserName = "user"
$sessionOptions.Password = "supersecret"
#$sessionOptions.SshHostKeyFingerprint = "ssh-rsa 2048 xx:xx:xx:xx:e8:da:54:12:6c:20:fa:78:24:b4:8d:69"
$sessionOption.GiveUpSecurityAndAcceptAnySshHostKey = $True

Note that I've commented out the SshHostKeyFingerprint and I am using GiveUpSecurityAndAcceptAnySshHostKey = $True.

When am getting the following error:
Property 'GiveUpSecurityAndAcceptAnySshHostKey' cannot be found on this object; make sure it exists and is settable

I believe this feature was introduced in 5.2 and I'm running version 5.5 of the WinSCPnet.dll so I am not sure why I would be getting this error. Can anyone help?

Thanks
Brad

Reply with quote

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
41,518
Location:
Prague, Czechia

Re: Property 'GiveUpSecurityAndAcceptAnySshHostKey'

You are missing s. It should be: $sessionOptions.GiveUpSecurityAndAcceptAnySshHostKey.

Reply with quote

martin
Site Admin
martin avatar

samv wrote:

worked for me
Is there any particular please you copied the typo from? Or is it just a coincidence that you both made the same mistake?

Reply with quote

samv
Joined:
Posts:
7
Location:
Canada

martin wrote:

samv wrote:

worked for me
Is there any particular please you copied the typo from? Or is it just a coincidence that you both made the same mistake?


Nope, Just reaffirming that GiveUpSecurityAndAcceptAnySshHostKey works as designed.

Reply with quote

Advertisement

You can post new topics in this forum