Click here to Skip to main content
15,887,596 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
The absolute same program, with same logged in user, runs correctly when invoked directly, but behaves differently when run as a scheduled task.

What am I missing? Any suggestions welcome, thank you in advance.

Edited to add program description:
The program is kind of like a console app - it downloads a file from an ftp url for further process. Specifically, the ftp download does not take place, when run from the scheduler. I know that the authentication has succeeded, but no file is downloaded.

What I have tried:

Some users in StackOverflow and MSDN suggest this might be due to user permissions. To check this out, I logged in as admin, created task as admin and configured the task to run as admin. Still same (wrong) result.
Posted
Updated 25-May-18 8:56am
v2
Comments
[no name] 25-May-18 13:56pm    
"but behaves differently", can you explain this more?

Anyway one big difference I think is, the program startet by Task Scheduler will run in session 0, because started by the Task Scheduler Service.


Similar issues I faced for (maybe) comparable situations, especially while printing from session 0.
ChandraRam 25-May-18 14:02pm    
Thank you for the reply.

The program is a console app - it downloads a file from an ftp url for further process. Specifically, the ftp download does not take place, when run from the scheduler. I know that the authentication has succeeded, but no file is downloaded.
[no name] 25-May-18 14:20pm    
You are very welcome. I have no experience with console apps.
Session 0 does not allow user interactions vs. console apps.... Sorry no idea at the Moment :( but keen on to follow this thread :-)

1 solution

Quote:
The program is kind of like a console app - it downloads a file from an ftp url for further process. Specifically, the ftp download does not take place, when run from the scheduler. I know that the authentication has succeeded, but no file is downloaded.

Change your app to log its activity to a log file, so that you can check what was done afterward.
Include each steps with information allowing you to check if a step was correct or not.
For example, include dialog with FTP server.
This should help you to narrow the search.
 
Share this answer
 
Comments
ChandraRam 25-May-18 15:00pm    
Thank you.

It already creates an activity log, which is how I know that the authentication passed. There is no error returned at the ftp download command, just that no file is downloaded.
Patrice T 25-May-18 15:05pm    
Change your program to write a dummy file where the downloaded file should go to ensure the scheduled program have writing permissions on that directory.
ChandraRam 25-May-18 15:12pm    
The program is able to write the activity log, so I guess write permissions on that folder exist.
Patrice T 25-May-18 15:20pm    
Log is in same directory ?
ChandraRam 25-May-18 15:21pm    
Yes, it is.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900