Post a reply

Before posting, please read how to report bug or request support effectively.

Bug reports without an attached log file are usually useless.

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

martin

Re: Scheduled Task fails, Manual Execution Successful

Please attach a full session log files from both scheduled and manual runs.

To generate the session log file, set Session.SessionLogPath. Submit the log with your post as an attachment. Note that passwords and passphrases not stored in the log. You may want to remove other data you consider sensitive though, such as host names, IP addresses, account names or file names (unless they are relevant to the problem). If you do not want to post the log publicly, you can mark the attachment as private.


Did you try connecting to the server using plain .NET Socket class?
grafix23

Scheduled Task fails, Manual Execution Successful

Created an exe file that is scheduled with Windows Task Scheduler in Windows Server 2016. When scheduled, the applications executes correctly until the WINSCP connection, when the process logs a failure when the connection is opened:
3/29/2021 7:31:15 PM: WinSCP.SessionRemoteException: Connection failed.

A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.
Connection failed.
   at WinSCP.SessionLogReader.Read(LogReadFlags flags)
   at WinSCP.ElementLogReader.Read(LogReadFlags flags)
   at WinSCP.SessionElementLogReader.Read(LogReadFlags flags)
   at WinSCP.CustomLogReader.TryWaitForNonEmptyElement(String localName, LogReadFlags flags)
   at WinSCP.CustomLogReader.WaitForNonEmptyElement(String localName, LogReadFlags flags)
   at WinSCP.Session.WaitForGroup()
   at WinSCP.Session.Open(SessionOptions sessionOptions)
   at ConsoleApplication1.Module1.Main() in C:\Projects\Module1.vb:line 192

If run interactively, the applications runs as expected, including opening the connection and uploading via WINSCP with no issues. Both the interactive user and the Scheduled Task user are local administrators on this server.