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

martin

Re: Error trying to use private key

I do not think, this has anything to do with any private key (after all, your code does not even show any use of any private key).

I'm pretty sure that your value of SshHostKeyFingerprint is wrong or incompatible with the version of WinSCP you are using. Show us the value, if you need our help.
andyh

Error trying to use private key

I'm getting a error trying to use a ppk file.
Error: The value supplied is not valid, or the property is read-only. Change the value, and then try again.

What am I doing wrong?

Thx.
# Load WinSCP .NET assembly
Add-Type -Path "C:\Program Files (x86)\WinSCP\WinSCPnet.dll"
 
# Read XML configuration file
[xml]$config = Get-Content "c:\demo\pros-config-testing.xml"
 
# Setup session options
$sessionOptions = New-Object WinSCP.SessionOptions -Property @{
    Protocol = [WinSCP.Protocol]::Sftp
    HostName = $config.Configuration.HostName
    UserName = $config.Configuration.UserName
    PortNumber = $config.Configuration.PortNumber
    SshHostKeyFingerprint = $config.Configuration.SshHostKeyFingerprint