WinSCP Scheduled Task Only Works when RDP is Connected

Advertisement

mrichman
Joined:
Posts:
1
Location:
United States

WinSCP Scheduled Task Only Works when RDP is Connected

I have a console app (VB.NET) very similar to the example code presented on this site. When run interactively, it can upload/download via SFTP without issues. When run via a Scheduled Task, it runs silently without issues. However, when my RDP session to the server disconnects, the Scheduled Task runs, but WinSCP fails with error messages like this:

The WinSCP executable appears to have crashed. Log file C:\Documents and Settings\MyServiceAccountName\Local Settings\Temp\tmp112F.xml does not exist.

Other times, the WinSCP.exe and WinSCP.com processes stay running and idle until I kill them.

Is there something special about running WinSCP from a console app running as a scheduled task that would cause this type of behavior?

Thanks,
Mark

Reply with quote

Advertisement

seyed
Guest

Re: WinSCP Scheduled Task Only Works when RDP is Connected

martin wrote:

I have sent you an email.

I have the below issue while running through .net on 2003 server. please advise.

The WinSCP executable appears to have crashed.Could not find the file C:\Documents and Settings\Admin\Local Settings\Temp\tmp112F.xml

Reply with quote

martin
Site Admin
martin avatar
Joined:
Posts:
41,441
Location:
Prague, Czechia

Re: WinSCP Scheduled Task Only Works when RDP is Connected

seyed wrote:

I have the below issue while running through .net on 2003 server. please advise.

The WinSCP executable appears to have crashed.Could not find the file C:\Documents and Settings\Admin\Local Settings\Temp\tmp112F.xml
How do you run WinSCP? Can you provide more details?

Reply with quote

Seyed
Guest

Re: WinSCP Scheduled Task Only Works when RDP is Connected

we are using vb.net program to do the transmission.

I can able to connect the SFTP server and transmit the file. but finally i'm receiving this error.

please help me!!!

martin wrote:

seyed wrote:

I have the below issue while running through .net on 2003 server. please advise.

The WinSCP executable appears to have crashed.Could not find the file C:\Documents and Settings\Admin\Local Settings\Temp\tmp112F.xml
How do you run WinSCP? Can you provide more details?

Reply with quote

Advertisement

tsantony
Donor
Joined:
Posts:
7

Re: WinSCP Scheduled Task Only Works when RDP is Connected

Hi,

did you resolved this case? if yes can you please share the solution?

we are also facing the same issue and we are using windows 2003 and vb.net


mrichman wrote:

I have a console app (VB.NET) very similar to the example code presented on this site. When run interactively, it can upload/download via SFTP without issues. When run via a Scheduled Task, it runs silently without issues. However, when my RDP session to the server disconnects, the Scheduled Task runs, but WinSCP fails with error messages like this:

The WinSCP executable appears to have crashed. Log file C:\Documents and Settings\MyServiceAccountName\Local Settings\Temp\tmp112F.xml does not exist.

Other times, the WinSCP.exe and WinSCP.com processes stay running and idle until I kill them.

Is there something special about running WinSCP from a console app running as a scheduled task that would cause this type of behavior?

Thanks,
Mark

Reply with quote

martin
Site Admin
martin avatar

Re: WinSCP Scheduled Task Only Works when RDP is Connected

I would like to help both of you, but you need to provide some details. Please share your code/commandline you use to run WinSCP. Share any logs (set Session.DebugLogPath).

Reply with quote

Alex23
Joined:
Posts:
1

Re: WinSCP Scheduled Task Only Works when RDP is Connected

Hi,

I have a SQL Server Integration Services package where I use an execute process task to start WinSCP with a script file. In the SQL Server Agent I have a job scheduled to start the package. This workerd fine untill the sftp server was changed. Now the scheduled job only works when my pc is connected via remote desktop connection with the server which runs the job.

This is the content of my script file:

option batch abort
option confirm off
open sftp://<SFTP-Server>/ -hostkey=<key>
get /download/*.csv \\%computername%\Data_D$\Temp\*.csv
exit

It would be realy great if anybody could help.

Thanks
Alex

Reply with quote

martin
Site Admin
martin avatar
Joined:
Posts:
41,441
Location:
Prague, Czechia

Re: WinSCP Scheduled Task Only Works when RDP is Connected

Alex23 wrote:

I have a SQL Server Integration Services package where I use an execute process task to start WinSCP with a script file. In the SQL Server Agent I have a job scheduled to start the package. This workerd fine untill the sftp server was changed. Now the scheduled job only works when my pc is connected via remote desktop connection with the server which runs the job.

This is the content of my script file:

option batch abort
option confirm off
open sftp://<SFTP-Server>/ -hostkey=<key>
get /download/*.csv \\%computername%\Data_D$\Temp\*.csv
exit

It would be realy great if anybody could help.
Did you update the host key?

Please attach a full session log file showing the problem (using the latest version of WinSCP).

To generate the session log file, use /log=C:\path\to\winscp.log command-line argument. 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.

Reply with quote

Advertisement

Alex#23
Guest

Re: WinSCP Scheduled Task Only Works when RDP is Connected

Hi Martin,

thanks for the quick response. yes, I updated the host key.

I could resolve the problem. I found this on your site

"If there was no such site 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)"

As I created the site for the new SFTP-server I had to realize, that I have no pemrission to set the "configuration storage" to "Windows registry". So I saved a custom INI-file which I think caused the problem. I asked my server admin to change the "configuration storage" to "Windows registry" and now it works again.

What I still doesn't understand is, that my log-file still has the following entry "Session name: KSIMDB@***.de (Ad-Hoc site)". I thought that "(Ad-Hoc site)" would no longer appear in the log.

Alex

Reply with quote

martin
Site Admin
martin avatar
Joined:
Posts:
41,441
Location:
Prague, Czechia

Re: WinSCP Scheduled Task Only Works when RDP is Connected

Alex#23 wrote:

What I still doesn't understand is, that my log-file still has the following entry "Session name: KSIMDB@***.de (Ad-Hoc site)". I thought that "(Ad-Hoc site)" would no longer appear in the log.
You get that whenever the open command sets any additional options (on top of the stored site).

Reply with quote

Advertisement

You can post new topics in this forum