Post a reply

Options
Add an Attachment

If you do not want to add an Attachment to your Post, please leave the Fields blank.

(maximum 10 MB; please compress large files; only common media, archive, text and programming file formats are allowed)

Options

Topic review

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
martin

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"?
support@heens-it.be

Re: Cannot login to site with Passphrase

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 ;-)
martin

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.
support@heens-it.be

Re: Cannot login to site with Passphrase

Forgot to mention.
Script runs on Windows 2008R2 and is a Powershell script
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?