Topic "Cannot login to site with Passphrase"

Author Message
Guest




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?
Advertisements
support@heens-it.be
[View user's profile]

Joined: 2017-05-31
Posts: 3
Location: Belgium
Forgot to mention.
Script runs on Windows 2008R2 and is a Powershell script
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 26331
Location: Prague, Czechia
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.
support@heens-it.be
[View user's profile]

Joined: 2017-05-31
Posts: 3
Location: Belgium
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 Wink
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 26331
Location: Prague, Czechia
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 Wink

Sorry, I do not understand. What "another place"? How are you "directing it"?
support@heens-it.be
[View user's profile]

Joined: 2017-05-31
Posts: 3
Location: Belgium
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
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