You probably depend on your configuration of WinSCP. Note that when using registry as configuration storage, the settings are accessible only for your Windows account. When the script is run from Windows Scheduler, SSIS, DTS or other automation service, it is typically run under different (service) account that cannot access your configuration.
Possible consequences are:
To check what configuration storage is used, whether a stored session name was recognised or under what Windows account the script is running, inspect a beginning of session log. For example, following log shows that the configuration was read from Windows registry, the script was running under local account martin and mysession was recognised as a stored session name.
-------------------------------------------------------------------------- WinSCP Version 5.0.2 (Build 1456) (OS 5.1.2600 Service Pack 3) Configuration: HKEY_CURRENT_USER\Software\Martin Prikryl\WinSCP 2\ Local account: INTRANET\martin Login time: 07 October 2011 08:55:53 -------------------------------------------------------------------------- Session name: mysession (Stored session)
If there was no such stored session in current configuration storage (Windows registry in this case), mysession (as passed to open command) would be interpreted as host name and the log line would say:
Session name: mysession (Ad-hoc session)
Solutions:
When dealing with SSIS see also guide to SFTP task in SSIS.
See also more generic article on making WinSCP work in a new environment (operating system, machine, user account, network).
Site design by Black Gate