473,419 Members | 1,564 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,419 software developers and data experts.

Windows Scheduled Tasks

303 Expert 100+
I have set up a scheduled task using admin username and password on a Windows XP, SP2 machine. When it runs, it runs great. However, it doesn't always run. Sometimes, the task status says it is running, but the program scheduled is not running. Anybody have any ideas why this would happen? Or, any suggestions for other, better task schedulers?
Jun 30 '08 #1
16 13924
NeoPa
32,556 Expert Mod 16PB
Where are you getting "task status" and "program scheduled is not running" from?
What is the scheduled task (Script file (.BAT; .CMD; .SCR; etc) or executable (.COM; .EXE))?
Jul 1 '08 #2
improvcornartist
303 Expert 100+
The status comes from the Control Panel Scheduled Tasks window. It shows name, schedule, run times, status. When I say it's not running, I mean that the actual scheduled program isn't doing what it should be doing. It should have a progress window and produce output, but it doesn't. It either doesn't really start, or it starts and just hangs, not doing anything.
The scheduled task is an executable. The executable does call a .BAT file also.
Jul 1 '08 #3
NeoPa
32,556 Expert Mod 16PB
Have you got the "Interact with Operator" flag set for the job?
Jul 1 '08 #4
improvcornartist
303 Expert 100+
Not that I am aware. The task is running on a server, and I don't always have full visibility. It may be that a file is locked, so the .BAT can't access it. Will that cause it to hang? I thought that would return false and continue the program.
Jul 1 '08 #5
NeoPa
32,556 Expert Mod 16PB
This sounds like it may get a little comlex.

Now would be a good time to explain clearly exactly what you're trying to do with this. What triggers what and what are the details of the AT command. Simply executing the command "AT" will list these details for you. I also need to know details of what is called by what within the executed command though of course.

For the Task Scheduler details - I'd like to know what is visible in the LogOn tab of the properties (Admin Tools / Services / Task Scheduler / Log On).
Jul 2 '08 #6
NeoPa
32,556 Expert Mod 16PB
FYI.
It's worth remembering that, by default, the scheduler is a System service which runs (generally invisibly) and has no access to the user credentials (after all, it can run when no user is logged on), so has no rights on any network resources. This can be a real gotcha for many people.
Jul 2 '08 #7
improvcornartist
303 Expert 100+
AT says there are no entries in the list. Task Scheduler details - Log on as local system account. Hardware Profile - Profile 1 Enabled.

I understand the FYI. But the task itself is set to run as administrator, so shouldn't it have necessary rights? Everything it is supposed to do is local.

The program itself: First, outputs (do command prompt window) that it is running and what it is currently doing. Then it calls a bat file, which opens an Access database and runs an autoexec macro to refresh some data and close Access. Then the program runs a query and saves the results in a csv file. The program should always send an email - either the program was successful, failed, or is taking longer than expected. As programmed, it should never take longer than expected. When it does take longer, the bat file doesn't seem to have run (the database hasn't changed). If there were an error, the call to the bat file should return false, and the program should continue, but it doesn't. I don't have admin rights, so I can't actually see the screen output. The task acts like it calls the bat file, then just sits and doesn't return to the program.

Like I said, sometimes it runs just fine, sometimes it doesn't seem to get anywhere. Last night it ran fine. If the problem is with Access (as it probably is), I am just curious why it runs sometimes and not others. My Access knowledge is very limited.
Jul 2 '08 #8
NeoPa
32,556 Expert Mod 16PB
This sounds like quite a complicated setup, but let's deal with this point by point, and be as clear and logical as we possibly can and see where that gets us.

Firstly then, your first two paragraphs seem to be contradicting each other. The local System account has strong local rights, but nothing at all across the network. The administrator, on the other hand, can run at various levels depending on which one it is (PC or Domain Administrator).

Secondly, perhaps you'd like to explain what is going on if there are no antries in the AT list :S

Thirdly, you will also need to explain much more fully what is leading to what within the task itself. Knowing generally that a bunch of individual processes are expected to run is not really anything I can work with.

Points to ponder :
It's very unlikely that anything run within Access is entirely contained within a single PC and only those resources provided by that PC. A network account is almost always required.

Lastly for now, with a setup like this it is important to be methodical and logical. Ignore anomalies until everything basic has been sorted out. Nine times out of ten, when you solve the obvious and easy problems, the more complex ones dissappear in the wash. Always do the simple and obvious first.
Jul 2 '08 #9
NeoPa
32,556 Expert Mod 16PB
Wow - I've been having loads of trouble trying to get this post to "take".

Eventually it went in twice of course :(, so apologies if you caught that before the site settled down (I was fully connected elsewhere without any problems).
Jul 2 '08 #10
improvcornartist
303 Expert 100+
Sorry for the confusion. Task Scheduler (Admin Tools / Services / Task Scheduler / Log On) has 'Log on as local system account' checked. But in the properties for this specific task (Control Panel / Scheduled Tasks / ), 'Run as' is set to Domain Admin, set up in this task with username and password. Rights should all be fine, as the task has run successfully many times (whether someone is logged in or not). I don't know about the AT list. Since I'm not logged in as admin, would it still show me what you need? Access does use a network resource, but it has all the necessary rights and passwords.

Step by step of the task:
1. The task starts a program.
2. The program outputs to the screen 'Refreshing data.'
3. The program calls a bat file.
4. The bat file opens an Access database.
5. The Access database runs an autoexec macro and closes.
6. The bat file is done, control returns to the program.
7. The program outputs to screen 'Data refreshed. Running program.'
8. The program does its stuff.

Whenever I run the task manually, it runs perfectly.
Jul 2 '08 #11
NeoPa
32,556 Expert Mod 16PB
Well, it seems that they've brought out some fundamental changes since I last played with scheduling in (NT based) Windows :(

It doesn't even seem to use the same fundamental system underneath (The AT list remains empty after adding a job - I tested that too and I DO log in as an Administrator).

Although I follow how the new system works, I'm afraid I can't see anything in your "system" which might cause it to fail intermittently.

May I just say that I like how you've automated the Access processing. We get quite a few questions on how to do this so it's nice to see someone actually using it "for profit" as it were.

Anyway, here are a couple of things to try. No guarantees. This is mainly for debugging purposes.
  1. Consider using a .CMD file instead of .Bat (BAT files are backwardly compatible with DOS - Little need nowadays to tie yourself down to that level).
  2. Simplify (for me at least) the process by scheduling the script file (.BAT or .CMD) which then would manage the messages, as well as invoking the Access part and then the .EXE part. An extra benefit of this is that any messages sent to the screen can be streamed to a log file at the same time (Use ">" & ">>" after the ECHO line to create, and append to, the log file). This lets you see what actually happened retrospectively by viewing the log file.
If I get any further ideas I'll post them.

Sorry I couldn't be more help.
Jul 3 '08 #12
improvcornartist
303 Expert 100+
I tried your two suggestions. I changed the bat file to cmd, and made it to control the main flow of the task. (The task starts the cmd, which calls Access, then the exe program.) I redirected the cmd output to a log file, so hopefully it will catch any errors that may occur. I'll try to implement it tonight and see what happens moving forward.

Thanks for all your input on this. I appreciate your help.
Jul 3 '08 #13
NeoPa
32,556 Expert Mod 16PB
No worries. I'm just sorry it all went beyond my current experience.

I remember a number of years back actually getting to grips with all the technicalities of scheduling in NT. It was not very straightforward but I got there anyway. Since then I believe the whole community has griped endlessly about how naff the earlier implementation was so, quite unsurprisingly, they've made some fundamental changes. This is probably good news overall, but leaves me a little behind on the new ways.

Anyway, congratulations on your new Expert status :)
Jul 4 '08 #14
improvcornartist
303 Expert 100+
This has been running with no problems since I changed it. So, either giving control to the cmd fixed it, or there was a lock on an Access database that has been resolved. In either case, your suggestions make a better solution for what I was trying to do.

Thanks.
Jul 10 '08 #15
NeoPa
32,556 Expert Mod 16PB
I'm very pleased to hear it. Thanks for posting :)
Jul 11 '08 #16
Hi
I am also facing same problem. I have scheduled windows task that calls vbs file. In vbs file there is a code to call the web service.
Sometumes the schedular remains in running mode. Then I do End Task and run the task manually it works fine. Then onwards it runs fine for some times. But again it hangs after some times.

Could you please suggest any solution.
Apr 27 '09 #17

Sign in to post your reply or Sign up for a free account.

Similar topics

5
by: Bart Simpson | last post by:
Hi, I want to control 'Scheduled Tasks' in Windows 2003 by python program. But I couldn't find any Python module about win32 'Scheduled Tasks'. I could find only Perl module about it. (see...
3
by: Lenn | last post by:
Hi, I developed a console .exe application which is going to run on scheduled basis, it will be scheduled to run in Windows Scheduled tasks. Client wants some kind of utility that would help them...
7
by: Dave Mandy | last post by:
Hi All I have written a C# console based program. The first line of code simply writes to the event log and this works 99% of the time, whether being run manually or kicked off by Windows...
2
by: Tatter | last post by:
I have a simple .NET 1.1 console application, written with Visual Studio .NET 2003, that needs to be run on a Windows XP system as a scheduled task. When run on its own, the program executes with no...
1
by: Matthew Connor | last post by:
Hi all! I need to be able to create Windows Scheduled Tasks and then read the properties of those tasks back in VB6. Because I could not find any APIs to interface with Windows Task Scheduler, I...
3
by: kj7ny | last post by:
How can I access and manipulate Scheduled Tasks in Windows using Python? I have a Windows XP workstation running Python 2.4.4 using the win32all modules to control the windows services on...
7
by: whutto | last post by:
I have a VB.NET app that crashes when run from the Windows scheduled tasks, but runs fine when the run-as user is logged on. The app also runs fine from the scheduled jobs if the run as user is...
0
by: kkkanoor | last post by:
I am trying to schedule tasks in Windows from my C# program. The tasks get listed in Windows Schedule Tasks list, but it is not getting invoked. It seems I need to give the user name and password to...
2
by: thj | last post by:
Hi, Is it possible to start an scheduled task on a server from ASP.NET? Thanks in advance. Tommy.
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.