I am new to using winSCP and Windows Task Scheduler. I am working on connecting to an external FTP server and copying its contents to a local directory on my PC.
When running my scheduled task, winSCP prompts me credentials to connect to the FTP server. If I press enter and submit nothing, the program runs as intended and copies all files to my local directory. If I do not interact, the program times out and does not complete.
What can I do to remove the need for entering credentials when connecting to the server? I would like this task to be fully automated. I’m assuming there is a line I can add to my script file to automate this?
Here is my winSCP default settings: (https://i.sstatic.net/UltbfzED.png)
Here is the Action being prompted by my Windows Task Scheduler:
Action: Start a Program
Program/script: C:Usersfurmand1AppDataLocalProgramsWinSCPWinSCP.com
Add arguments: /log=”C:Usersfurmand1DesktopLogwinscp.log” /script=”C:Usersfurmand1DesktopScriptScript.txt”
Here is the Script file I am running through winSCP:
# Connect
open 10.201.47.178
# Change directory
lcd C:Usersfurmand1DesktopFTP
# Download file to the local directory
mget *.*
# Disconnect
close
# Exit WinSCP
exit
Here is the Log file winSCP returns if I do not interact:
. 2024-06-24 16:27:59.663 --------------------------------------------------------------------------
. 2024-06-24 16:27:59.663 WinSCP Version 6.1.1 (Build 13736 2023-06-21) (OS 10.0.19045 – Windows 10 Enterprise)
. 2024-06-24 16:27:59.663 Configuration: HKCUSoftwareMartin PrikrylWinSCP 2
. 2024-06-24 16:27:59.663 Log level: Normal
. 2024-06-24 16:27:59.663 Local account: NAMfurmand1
. 2024-06-24 16:27:59.663 Working directory: C:WINDOWSsystem32
. 2024-06-24 16:27:59.663 Process ID: 29132
. 2024-06-24 16:27:59.678 Ancestor processes: WinSCP, ...
. 2024-06-24 16:27:59.678 Command-line: "C:Usersfurmand1AppDataLocalProgramsWinSCPWinSCP.exe" /console=6.1.1 /consoleinstance=_21632_881 "/log=C:Usersfurmand1DesktopLogwinscp.log" "/script=C:Usersfurmand1DesktopScriptScript.txt"
. 2024-06-24 16:27:59.678 Time zone: Current: GMT-4, Standard: GMT-5 (Eastern Standard Time), DST: GMT-4 (Eastern Daylight Time), DST Start: 3/10/2024, DST End: 11/3/2024
. 2024-06-24 16:27:59.685 Login time: Monday, June 24, 2024 4:27:59 PM
. 2024-06-24 16:27:59.685 --------------------------------------------------------------------------
. 2024-06-24 16:27:59.685 Script: Retrospectively logging previous script records:
> 2024-06-24 16:27:59.685 Script: open 10.201.47.178
. 2024-06-24 16:27:59.685 --------------------------------------------------------------------------
. 2024-06-24 16:27:59.685 Session name: 10.201.47.178 (Ad-Hoc site)
. 2024-06-24 16:27:59.685 Host name: 10.201.47.178 (Port: 21)
. 2024-06-24 16:27:59.685 User name: (Password: No, Key file: No, Passphrase: No)
. 2024-06-24 16:27:59.685 Transfer Protocol: FTP
. 2024-06-24 16:27:59.685 Ping type: Dummy, Ping interval: 30 sec; Timeout: 15 sec
. 2024-06-24 16:27:59.685 Disable Nagle: No
. 2024-06-24 16:27:59.685 Proxy: None
. 2024-06-24 16:27:59.685 Send buffer: 262144
. 2024-06-24 16:27:59.685 UTF: Auto
. 2024-06-24 16:27:59.685 FTPS: None [Client certificate: No]
. 2024-06-24 16:27:59.685 FTP: Passive: Yes [Force IP: Off]; MLSD: Off [List all: Off]; HOST: Off
. 2024-06-24 16:27:59.685 Local directory: default, Remote directory: home, Update: Yes, Cache: Yes
. 2024-06-24 16:27:59.685 Cache directory changes: Yes, Permanent: Yes
. 2024-06-24 16:27:59.685 Recycle bin: Delete to: No, Overwritten to: No, Bin path:
. 2024-06-24 16:27:59.685 Timezone offset: 0h 0m
. 2024-06-24 16:27:59.685 --------------------------------------------------------------------------
. 2024-06-24 16:27:59.701 Username prompt (no username provided)
< 2024-06-24 16:27:59.701 Script: Prompting for credentials...
< 2024-06-24 16:28:52.057 Script: Connecting to 10.201.47.178 ...
. 2024-06-24 16:28:52.057 Connecting to 10.201.47.178 ...
. 2024-06-24 16:28:52.073 Connected with 10.201.47.178. Waiting for welcome message...
< 2024-06-24 16:28:52.073 220 R-30iB mate FTP server ready. [LR V9.30P/27]
> 2024-06-24 16:28:52.073 USER
< 2024-06-24 16:28:52.095 230 User logged in [NORM].
> 2024-06-24 16:28:52.095 SYST
< 2024-06-24 16:28:52.095 215 UNKNOWN [LR V9.30P/27].
> 2024-06-24 16:28:52.095 FEAT
< 2024-06-24 16:28:52.111 500 Command not understood.
< 2024-06-24 16:28:52.111 Script: Connected
. 2024-06-24 16:28:52.111 Connected
. 2024-06-24 16:28:52.111 --------------------------------------------------------------------------
. 2024-06-24 16:28:52.111 Using FTP protocol.
. 2024-06-24 16:28:52.111 Doing startup conversation with host.
< 2024-06-24 16:28:52.111 Script: Starting the session...
> 2024-06-24 16:28:52.111 PWD
< 2024-06-24 16:28:52.111 257 "md:" is current directory.
. 2024-06-24 16:28:52.111 Getting current directory name.
. 2024-06-24 16:28:52.111 Startup conversation with host finished.
< 2024-06-24 16:28:52.111 Script: Session started.
< 2024-06-24 16:28:52.111 Script: Active session: [1] 10.201.47.178
< 2024-06-24 16:28:52.111 Script: Terminated by user.
. 2024-06-24 16:28:52.111 Script: Exit code: 1
. 2024-06-24 16:28:52.126 Disconnected from server
user25704552 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.