Task in scheduler doesn't work properly

Advertisement

thies
Joined:
Posts:
1

Task in scheduler doesn't work properly

Hello,
my task in Windows Task scheduler (Windows Version 1803) doesn't cannot connect to the server in the first try but works fine afterwards.
In both cases the task is executed by a service account and none of the settings are changed. In the first try I get the error
" Connection has been unexpectedly closed. Server sent command exit status 0. Authentication log (see session log for details): Using username "USERNAME". Further authentication required
Authentication failed."
I already created two log files (one for the fail, one for the working run) and attached them (marked as private). Unfortunately I don't have access to the server.

I'm using this code in powershell:
# Setup session options
                $sessionOptions = New-Object WinSCP.SessionOptions -Property @{
                    Protocol = [WinSCP.Protocol]::Sftp
                    HostName = $customer.FTPSettings.server;
                    Portnumber = $customer.FTPSettings.portnumber;
                    UserName = $customer.FTPSettings.user;
                    SecurePassword = ConvertTo-SecureString $customer.FTPSettings.password -Key $key;
                    SshHostKeyFingerprint = $customer.FTPSettings.SSHKey;}
 
                $session = New-Object WinSCP.Session

                try
                {


                # Connect
                $session.Open($sessionOptions)

                $transferOptions = New-Object WinSCP.TransferOptions
                $transferOptions.TransferMode = [WinSCP.TransferMode]::Automatic;
                $transferOptions.PreserveTimestamp = $false;
        
                $sychronisationResult = $session.GetFiles(
                    $downloadpath,
                    $repositorydirProgress,
                    $false,
                    $transferOptions
                );

Thanks for your help.[/code]
  • FTPLog.log (18.99 KB, Private file)

Reply with quote

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
29,070
Location:
Prague, Czechia

Re: Task in scheduler doesn't work properly

Please start by contacting the server administrator to get some explanation why the authentication is failing.

Reply with quote

Advertisement

You can post new topics in this forum