Post a reply

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)


Topic review

Paul Martell-Mead

Figured it out

Right – so the issue for me is I had the value enclosed in quotes and this won't pass validation for the fingerprint.
Paul Martell-Mead

Same here

I am seeing the exact same behaviour here.

I have an INI file containing the settings for the script which reads key/value pairs into PowerShell variables. All parameters work fine this way except SshHostKeyFingerprint. I can use my SshHostKeyFingerprint value hard-coded in the script and it works fine, so this proves it isn't an issue with the actual value (which is what the above answer implies).

Fingerprint SFTP connection variable assigned PowerShell


I have a PowerShell script in which the credentials are set dynamically via variables. For hostname, username, password this works. But not for the fingerprint. I always get the following message:
New-Object : The specified value is invalid, or the property is read-only. Change the value and repeat the operation.

Here is an excerpt of my script. The values was replaced by "xxxx".
function getCreds(){
        hostname = ''
        username = ''
        pwd = ''
        fingerprint = ''   
    $creds.hostname = 'xxxx'
    $creds.username = 'xxxx'
    $creds.pwd = 'xxxx'
    $creds.fingerprint = 'ssh-rsa 1024 xxxx'
    return $creds
function transferFile($creds){
    $sessionOptions = New-Object WinSCP.SessionOptions -Property @{
        Protocol = [WinSCP.Protocol]::Sftp
        HostName = $creds.hostname
        UserName = $creds.username
        Password = $creds.pwd
        SshHostKeyFingerprint = $creds.fingerprint