Re: Auth abruptly started failing for COM library but not for Client
The server can differentiate connections from different versions of WinSCP. If the two installations use the same version, the server cannot differentiate them.
<path>\install.ps1 : Exception calling "Open" with "1" argument(s): "Authentication failed.
Authentication log (see session log for details):
Using username "j****d@*****.com".
Access denied.
Authentication failed."
Add-Type -Path "<path>\WinSCP-6.5.4-Automation\WinSCPnet.dll"
$credential = $null
if ($host -and $host.UI -and $host.UI.PromptForCredential) {
$credential = $host.UI.PromptForCredential(
$Config.LoginTitle,
$Config.LoginPrompt,
"",
"MyCompany-SFTP"
)
}
if (-not $credential) { throw "Credentials not provided." }
$session = New-Object WinSCP.Session
$session.DebugLogPath = $Config.DebugLogPath
$session.DebugLogLevel = $Config.DebugLogLevel
$session.add_FileTransferProgress( { Show-FileTransferProgress($_) } )
$session.Open(
(New-Object WinSCP.SessionOptions -Property @{
Protocol = [WinSCP.Protocol]::Sftp
HostName = $Config.HostName
UserName = $credential.UserName
SecurePassword = $credential.Password # Password: A SecureString containing the password.
SshHostKeyFingerprint = $Config.HostKeyFingerprint
})
)