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

jackd

Auth abruptly started failing for COM library but not for Client

I am using the following code to connect to our sftp server.
Up until a few hours ago this was working.
I can connect via the same user/password via the WinSCP client (Full Install), but not via the COM library (WinSCP-6.5.4-Automation.zip).
I receive the following error:
<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."

I have verified my credentials and that this is the only WinSCPnet.dll available to the PowerShell 5.x script.
Is there any known issue, or have they simply blocked the call from the library?
I can post redacted logs if necessary.
Thank you

    

    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
        })
    )