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
The Following is being pushed to the logs
If I connect to the same target server with full logging via the GUI it is faulting as follows
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?
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
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 ===
< 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).Is anyone able to help me sort out my connection to this recalcitrant server?