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

Veshengo

Huge thanks for the rapid reply.
martin

Re: PowerShell SFTP Call failing with Error 77

You can configure the ProtocolFeatures the same way you are configuring the PreferredHostKeyAlgorithm and HostKeyAlgorithms:
$sessionOptions.AddRawSettings("ProtocolFeatures", "-vendor-id")

See https://winscp.net/eng/docs/rawsettings
Veshengo

PowerShell SFTP Call failing with Error 77

I am scripting a PowerShell solution for automated file transfer using the WinSCP library
The session preparation code is as follows
# Load WinSCP .NET assembly
Add-Type -Path "C:\Program Files (x86)\WinSCP\WinSCPnet.dll"
 
# Setup session options
$sessionOptions = New-Object WinSCP.SessionOptions
$sessionOptions.Protocol = [WinSCP.Protocol]::Sftp
$sessionOptions.HostName = "fmisoic01.prod.services"
$sessionOptions.UserName = $SFTPIdentity
$sessionOptions.SecurePassword = $Password
$sessionOptions.AddRawSettings("PreferredHostKeyAlgorithm", "ssh-rsa")
$sessionOptions.AddRawSettings("HostKeyAlgorithms", "ssh-rsa")
 
# Required host key
$sessionOptions.SshHostKeyFingerprint = $HostFingerprint
 
$session = New-Object WinSCP.Session

The Following is being pushed to the logs
2025-12-09 14:58:58 : === SFTP TRANSFER START ===

2025-12-09 14:59:07 : ERROR: Exception calling "Open" with "1" argument(s): "SFTP protocol violation: Invalid response message type (77).
Error getting name of current remote directory."
2025-12-09 14:59:07 : === SFTP TRANSFER END ===

If I connect to the same target server with full logging via the GUI it is faulting as follows
< 2025-12-08 12:22:44.953 Type: Unknown message (77), Size: 14, Number: 1634890857
< 2025-12-08 12:22:44.953 4D,61,72,74,69,6E,20,50,72,69,6B,72,79,6C,
. 2025-12-08 12:22:44.953 Attempt to close connection due to fatal exception:
* 2025-12-08 12:22:44.953 SFTP protocol violation: Invalid response message type (77).

This seems to be related to the issue outlined in https://winscp.net/forum/viewtopic.php?t=33496, I am looking for how to not trip on this configuration issue in a scripted scenario
Is anyone able to help me sort out my connection to this recalcitrant server?