Cannot login to site with Passphrase

Advertisement

Guest

Cannot login to site with Passphrase

Hi I'm using WinSCP 5.9.5.0

I've made a script to download some files from a remote site which uses a private key and a passphrase.

The Winscp part of the script is
{
# Load WinSCP .NET assembly
Add-Type -Path "E:\location\WinSCPnet.dll"
# Setup session options
$sessionOptions = New-Object WinSCP.SessionOptions -Property @{
Protocol = [WinSCP.Protocol]::Sftp
HostName = "data.xxxxxxxxxx.com"
UserName = "my username"
PrivateKeyPassphrase = "*P,7$+Y#}^k@^"
SshPrivateKeyPath = "E:\location\bdl.ppk"
SshHostKeyFingerprint = "ssh-rsa 1024 the fingerprint"
}

And when I run the script I'm getting
Member "PrivateKeyPassphrase" not found for the given .NET object.

What am I doing wrong?

Reply with quote

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
40,567
Location:
Prague, Czechia

Re: Cannot login to site with Passphrase

Your code is correct. If it does not work, it's probably because you are actually not using WinSCP .NET assembly 5.9.5, but some older one.

Reply with quote

martin
Site Admin
martin avatar
Joined:
Posts:
40,567
Location:
Prague, Czechia

Re: Cannot login to site with Passphrase

support@heens-it.be wrote:

Hi Martin,
is it possible it gets the dll from another place? as in the scriopt i'm directing it to the 5.9.5 version ;-)
Sorry, I do not understand. What "another place"? How are you "directing it"?

Reply with quote

Advertisement

support@heens-it.be

Re: Cannot login to site with Passphrase

With directing, I meant "Add-Type -Path "E:\location\WinSCPnet.dll"
But I've found it...
It seemed that I had to close the powershell windows and reopen it, because it held the old dll in memeory instead of loading the correct one with the "Add-Type -Path "E:\location\WinSCPnet.dll" command

Reply with quote

Advertisement

You can post new topics in this forum