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
# 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