Calling all Vista Task Scheduler experts

M

Marco Desloovere

Either there is something wrong with the Task Scheduler in my Vista or
it is a general problem or I have made a silly mistake.
I've already had a look in Microsoft's KB, but couldn't find a response
to this problem.

I want to create a very simple task: Every 9 days I would like to
display a short reminding message every 30 minutes on that 9th day.
A similar task works very well with my Windows 98 SE system, but is
impossible to achieve with my Vista.

In Vista I use "On a schedule" starting at 05:00 in the morning with a
"Daily" interval of 9.
Then "Repeat task every" 30 minutes for a duration of 19 hours.

In Windows 98 SE this works correctly, the task starts 9 days later and
repeats every 30 minutes for 19 hours, but not so in my Vista, where the
task starts immediately and then repeats every 30 minutes.
Setting the starting date manually to 9 days later will obviously work,
but then I would have to set this interval *manually* every 9 days,
which renders an automatic task scheduler pretty useless.

There is one weirdness, though.
If I set "Repeat task every" *and* duration to the identical values
*and* check "Stop at duration end", then the task will start 9 days
later, but will not repeat, i.e. it will only execute once on that 9th
day. For other values, checking "Stop at duration end" does not solve
the problem.

I believe that I have tried all relevant logical combinations before
posting this message.

Could anybody shed some light on this please, or confirm that there is
in fact a problem in the Task Scheduler?

Marco
 
K

Kerry Brown

Marco Desloovere said:
Either there is something wrong with the Task Scheduler in my Vista or
it is a general problem or I have made a silly mistake.
I've already had a look in Microsoft's KB, but couldn't find a response
to this problem.

I want to create a very simple task: Every 9 days I would like to
display a short reminding message every 30 minutes on that 9th day.
A similar task works very well with my Windows 98 SE system, but is
impossible to achieve with my Vista.

In Vista I use "On a schedule" starting at 05:00 in the morning with a
"Daily" interval of 9.
Then "Repeat task every" 30 minutes for a duration of 19 hours.

In Windows 98 SE this works correctly, the task starts 9 days later and
repeats every 30 minutes for 19 hours, but not so in my Vista, where the
task starts immediately and then repeats every 30 minutes.
Setting the starting date manually to 9 days later will obviously work,
but then I would have to set this interval *manually* every 9 days,
which renders an automatic task scheduler pretty useless.

There is one weirdness, though.
If I set "Repeat task every" *and* duration to the identical values
*and* check "Stop at duration end", then the task will start 9 days
later, but will not repeat, i.e. it will only execute once on that 9th
day. For other values, checking "Stop at duration end" does not solve
the problem.

I believe that I have tried all relevant logical combinations before
posting this message.

Could anybody shed some light on this please, or confirm that there is
in fact a problem in the Task Scheduler?


You want a daily trigger with a start date nine days from now set to recur
every nine days.
 
M

Marco Desloovere

Kerry said:
You want a daily trigger with a start date nine days from now set to recur
every nine days.

Yes, that is not the problem, but rather when I want the reminder
message to display repetitively every 30 minutes on the 9th day is what
does not work. The task starts its 30-minute repetition at once and
doesn't stop.

Marco
 
K

Kerry Brown

Marco Desloovere said:
Yes, that is not the problem, but rather when I want the reminder
message to display repetitively every 30 minutes on the 9th day is what
does not work. The task starts its 30-minute repetition at once and
doesn't stop.


On the trigger screen you picked:

Repeat task every 30 minutes for a duration of 1 day?
 
M

Marco Desloovere

Kerry said:
On the trigger screen you picked:

Repeat task every 30 minutes for a duration of 1 day?

I have prepared a screenshot of the trigger page for you. Although it is
in French, I hope that the positions of the trigger fields correspond to
the English version: http://users.belgacom.net/marecko/trigger.png

If the values of "Repeat task every" and duration are different, then
the task will start immediately and repeat at the rate of the repetition
value. Checking "Stop at duration end" has no effect.
On the other hand, if the two values are the same *and* "Stop at
duration end" is checked, the task will run 9 days later, but only once,
i.e. it will not repeat that day, but it will run again 9 days later.

It is not necessary to wait for 9 days, as the time and date are shown
in the "Next Run Time" column of that task.
You could check this on your Vista machine. If the run times are shown
as expected, then there must be a problem with my Vista.

Marco
 
K

Kerry Brown

Marco Desloovere said:
I have prepared a screenshot of the trigger page for you. Although it is
in French, I hope that the positions of the trigger fields correspond to
the English version: http://users.belgacom.net/marecko/trigger.png

If the values of "Repeat task every" and duration are different, then
the task will start immediately and repeat at the rate of the repetition
value. Checking "Stop at duration end" has no effect.
On the other hand, if the two values are the same *and* "Stop at
duration end" is checked, the task will run 9 days later, but only once,
i.e. it will not repeat that day, but it will run again 9 days later.

It is not necessary to wait for 9 days, as the time and date are shown
in the "Next Run Time" column of that task.
You could check this on your Vista machine. If the run times are shown
as expected, then there must be a problem with my Vista.


I'm not going to get a chance to try this for a couple of days. When I get a
chance I'll try it and see what happens.
 
J

Jon

Marco Desloovere said:
I have prepared a screenshot of the trigger page for you. Although it is
in French, I hope that the positions of the trigger fields correspond to
the English version: http://users.belgacom.net/marecko/trigger.png

If the values of "Repeat task every" and duration are different, then
the task will start immediately and repeat at the rate of the repetition
value. Checking "Stop at duration end" has no effect.
On the other hand, if the two values are the same *and* "Stop at
duration end" is checked, the task will run 9 days later, but only once,
i.e. it will not repeat that day, but it will run again 9 days later.

It is not necessary to wait for 9 days, as the time and date are shown
in the "Next Run Time" column of that task.
You could check this on your Vista machine. If the run times are shown
as expected, then there must be a problem with my Vista.

Marco



Your 'pour une durée' section should be set to '19 heures' according to your
original specification.

Also the next run time for the task isn't a definitive guide to whether the
task will actually run or not. It can 'run' and realize that it shouldn't
run, and so effectively do nothing (if that makes sense).
 
M

Marco Desloovere

Jon said:
Your 'pour une durée' section should be set to '19 heures' according to your
original specification.

No matter what value I put there, for as long as this value is
*different* from the repeat value, the task will start immediately, as
though I had chosen an interval value of 1 day instead of 9 days.
This is very irritating, because an identical task works very well in my
good old Windows 98 SE system.
Also the next run time for the task isn't a definitive guide to whether the
task will actually run or not. It can 'run' and realize that it shouldn't
run, and so effectively do nothing (if that makes sense).

Well, I can confirm that the "Next Run Time" shown in the task does
correspond to the actual start of the task.

Marco
 
M

Marco Desloovere

Kerry said:
I'm not going to get a chance to try this for a couple of days. When I get a
chance I'll try it and see what happens.

OK, take your time, I have a pretty lame workaround for the moment.

Marco
 
J

Jon

No matter what value I put there, for as long as this value is
*different* from the repeat value, the task will start immediately, as
though I had chosen an interval value of 1 day instead of 9 days.
This is very irritating, because an identical task works very well in my
good old Windows 98 SE system.

If you make any changes at all to the existing task,or set up a new task,
then you always need to ensure that you set a new date in the *future* (the
'Démarrer' line in your jpg). Otherwise the Task Scheduler just sees a date
in the past and so sets the start date to the current time. It looks like
it's using a fairly simple algorithm for this that doesn't try and work out
what the next run date should be if the date is in the past. This explains
why the task is starting immediately. Experiment with this and you'll see
what I mean.


Secondly, if you set the 2 vaues you mentioned to the be the same ('Repeat
task every' (Répéter la tache tous les' ) and 'For a duration of' ('pour une
durée' de)), then this effectively means that the task only runs once ie
there is *no repeat involved*, ie the task becomes equivalent to scheduling
the task to run once only every 9 days at a specific time. So this explains
what you observed there.

Well, I can confirm that the "Next Run Time" shown in the task does
correspond to the actual start of the task.

Marco



Combining 2 sets of criteria in one task (ie 'every 9 days' and 'every 30
minutes'), doesn't look like it runs that reliably. I don't know what the
'lame workaround' was that you mentioned in your other post, but it may be
worth considering splitting this into 2 tasks eg

Task A: Runs once every 9 days at 5:00 and launches task B
(you can use 'schtasks' for this ... schtasks /? )

Task B: Shows a message every 30 minutes for 19 hours from 5:00
 
M

Marco Desloovere

Jon said:
If you make any changes at all to the existing task,or set up a new task,
then you always need to ensure that you set a new date in the *future* (the
'Démarrer' line in your jpg). Otherwise the Task Scheduler just sees a date
in the past and so sets the start date to the current time. It looks like
it's using a fairly simple algorithm for this that doesn't try and work out
what the next run date should be if the date is in the past. This explains
why the task is starting immediately. Experiment with this and you'll see
what I mean.

If I set a date in the past - as I did in my example here for the 1st of
September - with an interval of 9 days, Task Scheduler will calculate
the correct multiples of 9 days if, and only if I set identical values
for repeat and duration. If the values are different, Task Scheduler
will start the task immediately, ignoring the interval and the duration.

If I set a date in the future, say 9 days from now, and choose different
values for repeat and duration, Task Scheduler will indeed run the task
in 9 days time and repeat it for the value in repeat, but it will once
again ignore the duration and continue forever, skipping now and then a
repetition time. Yet another weirdness!
Secondly, if you set the 2 vaues you mentioned to the be the same ('Repeat
task every' (Répéter la tache tous les' ) and 'For a duration of' ('pour une
durée' de)), then this effectively means that the task only runs once ie
there is *no repeat involved*, ie the task becomes equivalent to scheduling
the task to run once only every 9 days at a specific time. So this explains
what you observed there.

Yes, I agree, but then why doesn't the task also start in 9 days, when I
set a different duration value to the repeat value?
Combining 2 sets of criteria in one task (ie 'every 9 days' and 'every 30
minutes'), doesn't look like it runs that reliably.

The alternatives would be to run the task only once, either at a
specific time or at start-up or similar. But I may miss the task when
it's only run once, and that is why I want it to be repeated several
times on a specific day.
I'll say it again: This task works perfectly well in my Windows 98 SE
system, but I can't get it to work in my Vista.
I don't know what the
'lame workaround' was that you mentioned in your other post,

The compromise is to run the task only once every 9 days, because
repeating doesn't work.
but it may be
worth considering splitting this into 2 tasks eg

I have tried to look into that. Run the first task every 9 days and then
have another task (which would repeat every 30 minutes) be triggered "On
an event", and the event being the first task, but I gave up, because I
couldn't figure out what exactly they meant by event ID. I managed to
crash Vista, as I mistakenly used the event ID (319) of the task itself,
which generated over 26.000 events after a short while. Apparently too
much for Vista to handle, as it didn't even see that something was in a
fatal loop inside its guts.

Also, I don't understand why it needs to be that complicated, when it is
so easy to accomplish the same thing in Windows 98 SE.
Task A: Runs once every 9 days at 5:00 and launches task B
(you can use 'schtasks' for this ... schtasks /? )

Task B: Shows a message every 30 minutes for 19 hours from 5:00

I was unable to create task B, because schtasks asks to specify a
trigger, like "On a schedule", "At log on", etc.
So we're back to square one.

I also feel that it would be a crying shame to use the user-unfriendly
Command prompt to create a task in super duper hi-tech Vista, when that
simple task I want can so easily be created in Stone Age Windows 98 SE.

Marco
 
J

Jon

I won't be around for the next couple of days either now, but
time-permitting, I'll have another look at it, and examine your last
reponse, and if I can discover or think of anything useful, I'll post back.

In the meantime Kerry, or someone else, may come back with some other
suggestions, or you may discover something else yourself.

Either way I'll check back in a couple of days to see how things have
progressed.

But you're right. It certainly shouldn't be more complicated in Vista to
achieve what was easy under Windows 98.
 
M

Marco Desloovere

Jon said:
I won't be around for the next couple of days either now, but
time-permitting, I'll have another look at it, and examine your last
reponse, and if I can discover or think of anything useful, I'll post back.

In the meantime Kerry, or someone else, may come back with some other
suggestions, or you may discover something else yourself.

Well, what you could do is simply create a test task with the trigger
"On a schedule" and the date of the day you create the task and
arbitrarily use the time of 05:00.
Then tick "Daily" with an interval of 3 days.
For the advanced settings use "Repeat task every" 30 minutes and a
duration of 12 hours.
Then define a simple action of displaying a simple message.
Now have a look at the "Next Run Time" for that task.
If it shows that it is scheduled for the day of task creation, there is
a problem, otherwise it should show day of task creation plus three
(interval of 3 days).

If the "Next Run Time" shows that the task is scheduled for the day of
task creation, change the duration to 30 minutes (the same value as for
"Repeat task every") *and* tick "Stop at duration end".
Now check the "Next Run Time" for that task again.
Should it now show day of task creation plus three (interval of 3 days),
then your Vista has the same problem mine has, and we can start assuming
that it is a general Vista problem.
Either way I'll check back in a couple of days to see how things have
progressed.

Don't take too long, I just might install XP in the meantime... ;-)
But you're right. It certainly shouldn't be more complicated in Vista to
achieve what was easy under Windows 98.

Exactly, and I had another look at the task I created in my Windows 98
to compare it step by step with the task I had created under Vista.
This task is really so simple that it is virtually impossible to make a
mistake.

Marco
 
J

Jon

Well, what you could do is simply create a test task with the trigger
"On a schedule" and the date of the day you create the task and
arbitrarily use the time of 05:00.
Then tick "Daily" with an interval of 3 days.
For the advanced settings use "Repeat task every" 30 minutes and a
duration of 12 hours.
Then define a simple action of displaying a simple message.
Now have a look at the "Next Run Time" for that task.
If it shows that it is scheduled for the day of task creation, there is
a problem, otherwise it should show day of task creation plus three
(interval of 3 days).

If the "Next Run Time" shows that the task is scheduled for the day of
task creation, change the duration to 30 minutes (the same value as for
"Repeat task every") *and* tick "Stop at duration end".
Now check the "Next Run Time" for that task again.
Should it now show day of task creation plus three (interval of 3 days),
then your Vista has the same problem mine has, and we can start assuming
that it is a general Vista problem.

I do get the correct 'Next Run Time' showing correctly here in both cases,
and my test task ran at the correct time. A couple of observations, though.

1. Sometimes you need to press F5 in Task Scheduler for it to show the new
correct start time

and

2. I think the 'Next Run Time' is misleading, when there is any kind of
repeat set, as I believe it always shows the next instance of the repeat
interval, regardless of whether the task will actually run then or not. This
next example hopefully illustrates this...

I created a daily test task for 5 minutes hence to show a message once a
minute for 3 minutes. This worked correctly - the message showed 3 times and
then stopped showing. After it had stopped showing I noticed that the 'Next
Run Time' column was showing a minute hence, but that the task didn't run at
that time. From this I conclude that this is some kind of 'check time' ie
Task Scheduler checks to see if the task should run and concludes that it
doesn't.

One bizarre thing there was that when I rebooted after the task had
completed its 3 messagebox popups, the task ran again soon after login,
despite the fact that is was past its expiry! Odd.

So I'm kind of concluding that it's not a very reliable method.


So here's a couple of possible suggestions for solutions to the problem.....

SUGGESTION 1 (think I prefer suggestion 2 is better after I typed this out,
but I'll leave it in anyway)

3 tasks A,B,C.
Task A enables C every 9th day
Task B disables C every 9th day
Task C Shows a message every 30 minutes

Task A: Enables Task C. Scheduled for 5:00 am every 9th day

schtasks /Change /TN "<path>" /Enable

So the program here is

C:\Windows\System32\schtasks.exe

and in the arguments box you'd put

/Change /TN "<path>" /Enable

where <path> is the Task Scheduler path to task C, which you can get from
the 'Folder' line in the output from this command (+ thjen add on
"\TaskName" )

schtasks /query

eg "\MyFolderTask\TaskC"
You might need to set this to run with highest prvileges ('General' tab for
the task)


Task B: Disables Task C. Scheduled for 23:59 pm every 9th day


Task C: Shows a message every 30 minutes.


I've typed that out, but I think I prefer this next suggestion, which is
simpler.....


SUGGESTION 2

Schedule a script like this once every 9th day for 5:00 am (no repeats) The
script itself handles the rest.
[Paste into notepad and save with a .vbs extension]


'-------------------------------------------------------
StartHour = 5
EndHour = StartHour + 19
MessageTitle = "MessageTitle"
MessageBody = "MessageBody"
MessageIntervalMinutes = 30
ScriptStartTime = Now



'Quit if it's outside the time range
If (Hour(Now) < StartHour) or _
(Hour(Now) > EndHour) Then _
WScript.Quit

'Loop
Do While(Hour(Now) < EndHour)

'Quit if the script has run too long
If DateDiff("h",Now, ScriptStartTime) > 24 Then _
Wscript.Quit


Do
If (Minute(Now) mod MessageIntervalMinutes) = 0 Then _
Exit Do
WScript.Sleep 30000
Loop


'Show a message
MsgBox MessageBody, vbOKOnly, _
MessageTitle

WScript.Sleep 60000


Loop

'---------------------------------------------------------------------

You may need to play with both those suggestions, since I've not tested
either.

Hope that helps.
 
J

Jon

A couple of additional comments
Task B: Disables Task C. Scheduled for 23:59 pm every 9th day

This is the same as Task A, substituting 'Disable' for enable in the comand
line.
'-------------------------------------------------------
StartHour = 5
EndHour = StartHour + 19

Just realised that your end time is midnight, or 00:00 so the script would
fail with that.

EndHour = StartHour + 18

should work though

Anyhow gives you a few ideas I hope


Jon
 
M

Marco Desloovere

First of all my apologies for the long silence, but there were a couple
of events that prevented me from replying earlier.

I do get the correct 'Next Run Time' showing correctly here in both cases,
and my test task ran at the correct time. A couple of observations, though.

Well, that virtually proves that my Vista Task Scheduler is screwed.
I wonder whether my Task Scheduler is interpreting the XML file of the
problem tasks incorrectly.
Around August 15th there was an Update (KB936181) SP2 for XML, but
uninstalling this didn't make any difference.

This is the XML extract of an exported task that starts on September 1st
2007 at 05:00 with a 9-day interval and then being repeated each hour
for one day. For an unknown reason this does not work correctly in my
Task Scheduler, because he just ignores (why?) the 9-day interval and
starts the task immediately using the specified repetition rate:

<Triggers>
<CalendarTrigger id="a0c8b1a1-c740-42e5-ad78-9aae101bc9d4">
<Repetition>
<Interval>PT1H</Interval>
<Duration>P1D</Duration>
<StopAtDurationEnd>false</StopAtDurationEnd>
</Repetition>
<StartBoundary>2007-09-01T05:00:00</StartBoundary>
<Enabled>true</Enabled>
<ScheduleByDay>
<DaysInterval>9</DaysInterval>
</ScheduleByDay>
</CalendarTrigger>
</Triggers>

If you create an identical task, does the trigger part look like the
above extract?

If I remove the repetition rate, then Task Scheduler will execute the
task every 9 days:

<Triggers>
<CalendarTrigger id="a0c8b1a1-c740-42e5-ad78-9aae101bc9d4">
<StartBoundary>2007-09-01T05:00:00</StartBoundary>
<Enabled>true</Enabled>
<ScheduleByDay>
<DaysInterval>9</DaysInterval>
</ScheduleByDay>
</CalendarTrigger>
</Triggers>


The first 2 lines of the XML file are as follows:

|<?xml version="1.0" encoding="UTF-16"?>
|<Task version="1.2" xmlns="http://schemas.microsoft.com/windows/2004/02/mit/task">

(ignore the vertical bar character "|", which I added so that my news
reader won't do a line wrap)
1. Sometimes you need to press F5 in Task Scheduler for it to show the new
correct start time

Yes, I have done that, although not necessary, because Task Scheduler
refreshes the page automatically.
and

2. I think the 'Next Run Time' is misleading, when there is any kind of
repeat set, as I believe it always shows the next instance of the repeat
interval, regardless of whether the task will actually run then or not. This
next example hopefully illustrates this...

I can't really confirm that.
I created a daily test task for 5 minutes hence to show a message once a
minute for 3 minutes. This worked correctly - the message showed 3 times and
then stopped showing. After it had stopped showing I noticed that the 'Next
Run Time' column was showing a minute hence, but that the task didn't run at
that time. From this I conclude that this is some kind of 'check time' ie
Task Scheduler checks to see if the task should run and concludes that it
doesn't.

Hmmm, perhaps the timing intervals are a little too tight here.
Difficult to say for sure.
One bizarre thing there was that when I rebooted after the task had
completed its 3 messagebox popups, the task ran again soon after login,
despite the fact that is was past its expiry! Odd.

So I'm kind of concluding that it's not a very reliable method.

As far as my particular problem is concerned the "Next Run Time" values
are definitely correct.
So here's a couple of possible suggestions for solutions to the problem.....

SUGGESTION 1 (think I prefer suggestion 2 is better after I typed this out,
but I'll leave it in anyway)

3 tasks A,B,C.
Task A enables C every 9th day
Task B disables C every 9th day
Task C Shows a message every 30 minutes

Task A: Enables Task C. Scheduled for 5:00 am every 9th day

schtasks /Change /TN "<path>" /Enable

So the program here is

C:\Windows\System32\schtasks.exe

and in the arguments box you'd put

/Change /TN "<path>" /Enable

where <path> is the Task Scheduler path to task C, which you can get from
the 'Folder' line in the output from this command (+ thjen add on
"\TaskName" )

schtasks /query

eg "\MyFolderTask\TaskC"
You might need to set this to run with highest prvileges ('General' tab for
the task)


Task B: Disables Task C. Scheduled for 23:59 pm every 9th day


Task C: Shows a message every 30 minutes.

Perhaps I'm doing something wrong, but I cannot create a task that runs
repeatedly for 30 minutes only, neither using schtasks nor with the GUI
Task Scheduler. I have to specify a trigger (otherwise schtasks shows an
error message), and then I'm of course back to square one.

Can you create a task without specifying a trigger?
I've typed that out, but I think I prefer this next suggestion, which is
simpler.....


SUGGESTION 2

Schedule a script like this once every 9th day for 5:00 am (no repeats) The
script itself handles the rest.
[Paste into notepad and save with a .vbs extension]

[ VBS script snipped ]

Thanks for the script, but this will require a fair amount of time to
test this.

Right now I would prefer to use that time to find out why my Vista Task
Scheduler does not work correctly.

Marco
 
G

Guest

This might be troublesome it you do notice the 5:00 am notification, but what
about scheduling 7 tasks that run at 9 day intervals? Task A for 5 am, Task
B 6 am, Task C, etc.

I'm having problems with Task Scheduler also. Consistently inconsistent.
So many choices, that is over complicates itself?
 
M

Marco Desloovere

Wendy said:
This might be troublesome it you do notice the 5:00 am notification, but what
about scheduling 7 tasks that run at 9 day intervals? Task A for 5 am, Task
B 6 am, Task C, etc.

Scheduling a *simple* 9-day interval task by itself works fine, but as
soon as I set something in the Advanced Settings of the trigger, this
9-day task turns into a 1-day task, despite the fact that the daily
interval is still set to 9 days. Very irritating indeed!
I'm having problems with Task Scheduler also. Consistently inconsistent.
So many choices, that is over complicates itself?

Well, it depends on what you want to accomplish. Start off by defining a
simple and obvious task, and see how it goes, or ask someone for help
here.

Marco
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top