Solved

Scheduled task does not run when logged out.

Posted on 2007-11-21
19
1,392 Views
Last Modified: 2013-12-05
I have written a vb6 app that links to outlook and populates contacts in a public folder.
i have tested and it works when ran from the 'Run' option from the start menu.
if i schedule the exe it doesnt run. it doesnt return any errors either. it just does nothing!
it has been working for 6 months scheduled and now it has just stopped working. i havent amended the exe or the scheduled task.

can anybody help?
0
Comment
Question by:3Si_pnewman
  • 8
  • 6
  • 4
  • +1
19 Comments
 
LVL 19

Expert Comment

by:MrLonandB
ID: 20327159
Simple question and you've probably checked, but is the task scheduled to run under a particular account and the login credentials of the account have changed recently?
0
 
LVL 1

Author Comment

by:3Si_pnewman
ID: 20327283
yes it is setup to run under a particular account but the credentials have not changed. i have gone through all the permission and the policies and the user has admin rights to almost everything.

0
 
LVL 9

Expert Comment

by:dreamyguy
ID: 20328147
what if you ask it to run under the system account?
what if you create a new scheduled task (just as a test) and allow it to run notepad using the same credentials, does that work?

can you also go to the scheduled tasks folder and then go to advanced-->view log and paste the logs here.
if you get Result: The task completed with an exit code of (0), that the operation completed successfully. in that case its not the task scheduler or the credentials that are the issue, its the task itself that's the issue. if that's the case, then begin by checking for permission related issues.
0
 
LVL 3

Expert Comment

by:philgin
ID: 20332668
Try creating a DOS batch (*.bat) file that calls/executes your program and add the Batch file to the Scheduled Task instead.

Test your batch file first if it executes your program.
And please use dos 8.3 format if possible.
0
 
LVL 1

Author Comment

by:3Si_pnewman
ID: 20333518
thanks for your help.
ive tried the batch file method already and it runs my exe when ran manally but not when scheduled.
the scheduled also doesnt run calc.exe
0
 
LVL 3

Expert Comment

by:philgin
ID: 20334504
When are you planning to run the scheduled task?
0
 
LVL 9

Expert Comment

by:dreamyguy
ID: 20334533
Is this happening on just this machine or other machines as well? This will help us determine whether the issue is BY DESIGN.
0
 
LVL 1

Author Comment

by:3Si_pnewman
ID: 20334544
i have tried running it during the day and at night,

it happens on two machines out of about 5 that i have it installed on.
0
 
LVL 3

Expert Comment

by:philgin
ID: 20334549
Make sure Task Scheduler Service is started: By default on all Windows XP machines Scheduler service is started. To make sure please go to Control Panel->Administrative Tools->Services. Verify that the Status of the ‘Task Scheduler’ service reads ‘Started’. If it is not running then right-click it and select ‘Start’. Also please ensure that the 'Startup type' is set to 'Automatic' so that next time your computer starts this service starts automatically.

If it still doesn't work then Restart Task Scheduler from the services by right-clicking it and Clicking Restart.
0
6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

 
LVL 3

Expert Comment

by:philgin
ID: 20334553
And then try testing the calc.exe again with the Task Scheduler.
0
 
LVL 9

Expert Comment

by:dreamyguy
ID: 20334656
next steps:
=========
can we have the schedlgu.txt?
What is the exit code that is logged for the failing job?
Try creating the job using the AT.EXE command


Reference:
==========
http://support.microsoft.com/kb/308558 - How to troubleshoot scheduled tasks in Windows XP and in Windows Server 2003
0
 
LVL 1

Author Comment

by:3Si_pnewman
ID: 20334756
the log file just shows the exe starting and then it eventually closes afer 72 hours(or whatwever i set it to).
the exit code it the success one.
0
 
LVL 9

Expert Comment

by:dreamyguy
ID: 20335258
wow this one is difficult. and you seem to be having a lot of patience as well :)
it doesnt seem to be an issue with task scheduler, and doesnt seem to look like a permissions issue either.
mmmm
is there any other info you can provide? i'll keep researching more in the interim.
have you tried runnign the task under the local system account or a different account? a local user account perhaps?
whats the version of mstask.dll on the affected machine as compared to a working machine? (just to make sure that the versions are the same)
0
 
LVL 1

Author Comment

by:3Si_pnewman
ID: 20357017
Hi,
thanks for all your help so far!!
i have got somewhere with this now but not fully resolved the problem.
the problem was that i was scheduling the job on my server and connecting to the server via Remote Desktop (aka terminal services). according to microsoft if you schedule a job whilst logged in via terminal services the job doesnt run in the session it runs on the server console (i.e. when you actually sit at the server). so this has resolved this bit.
my only problem know is that it runs successfully if i sit at the server and watch it but if the server is logged off the job doesnt run!!

0
 
LVL 9

Expert Comment

by:dreamyguy
ID: 20357073
what user account is the job running under? what if u change it to run under the local system account?
0
 
LVL 1

Author Comment

by:3Si_pnewman
ID: 20359212
the job is running under the administrator account.
0
 
LVL 9

Expert Comment

by:dreamyguy
ID: 20359317
my only problem know is that it runs successfully if i sit at the server and watch it but if the server is logged off the job doesnt run!!

when you look at the schedlgu.txt log, what error code do you get?

could you paste the log here?
0
 
LVL 1

Author Comment

by:3Si_pnewman
ID: 20365201
i dont get any error code. just get the success code.
it just ends the job after 3 minutes and returns success.
0
 
LVL 1

Accepted Solution

by:
3Si_pnewman earned 0 total points
ID: 21573166
Discovered:

Make sure that the TASK SCHEDULER service is ticked for "Allow interaction with Desktop".  Also, if any of the command lines, script being called, BAT files being utilised, etc. use Drive Mappings to network shares then these should be replaced with full UNC paths as the drive letter reference might not be resolved because the user is not logged on and therefore a NETLOGON script not executed.
0

Featured Post

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

A list of useful business intelligence software.
Know what services you can and cannot, should and should not combine on your server.
The viewer will learn common shortcuts with easy ways to remember them. The viewer will then learn where to find all of the keyboard shortcuts, how to create/change them, and how to speed up their workflow.
This video will demonstrate how to find the puppet warp tool from the edit menu and where to put the points to edit.

757 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now