7

How to add a scheduled task that should run every x-minutes on Windows Server 2003 R2.

I have followed many suggestion from the web, but I always end up with some interruption after 1 or 2 runs.

Here is what I did:

  1. New Scheduled Task

  2. Schedule > Daily Task 08:00 AM, every 1 day

  3. Schedule > Advanced > Repeat task every 30 minutes, duration 31 minutes (why???)

  4. Enabled it

Not working after 1 run and the next run time is +1 day at 08:00 AM

How to fix this problem?

3
  • 1
    Show us the schedule log, that will help figure it out. Also, check the System event log for the times it fails.
    – mfinni
    May 28, 2013 at 13:09
  • @mfinni where can I find schedule log? Not sure if it fails or it is just the logic. But lets start with schedule log.
    – John
    May 28, 2013 at 13:14
  • @mfinni found it
    – John
    May 28, 2013 at 13:25

4 Answers 4

7

It sounds like the task might not be completing successfully, and multiple instances of the task might be trying to run at the same time.

Open up Scheduled Tasks from the Control Panel.

Right click on the task you've created and click "Properties."

Navigate to the "Schedule" tab.

Choose the start time (00:10 AM)

Make sure that Schedule Task Daily is set to Every 1 day(s).

Click Advanced.

Check the "Repeat Task" checkbox.

Until: (select bullet) Time: (enter 11:59 PM) and click "OK"

Open the "Settings" tab now.

[Check] Stop the task if it runs for: [0] hour(s) and [9] minute(s). Click "OK" This will prevent multiple instances of the scheduled task from running at the same time, possibly causing the conflicts you've described.

If the scheduled task is set to run every 30 minutes, set it to stop the task after 29 minutes (in case it hangs for some reason).

If this is the problem you'll want to look at what your task is doing, and see what might be causing it to hang. A successfully executed task will exit with Last Result = 0x0.

4

You can try this:

schtasks /create /tn "Task Name" /tr <path to script> /sc minute /mo 10

This task will run every 10 minutes, the first time is right after you make this command.

3

Schedule the task in this way:

  • Daily at 00:00 AM, every 1 day
  • Repeat task every x minutes to 11:59 PM (or duration: 23h 59m)

Duration 31 minutes will cause the task to be repeated only once (so it will be run at 8:00 AM and 8:30 AM).

3
  • +1 because I never even thought of trying to use 00:00 AM. I can never seem to remember when 12:00 AM or PM occurs. Afternoon or Midnight... why is that so hard I wonder? Thanks!
    – Lucretius
    May 28, 2013 at 16:03
  • Well, I use 24-hour format on daily basis, I used AM/PM notation because John used it. Now I see I made a mistake. I should wrote 12:00 AM. And it looks like this is quite common problem for many people: en.wikipedia.org/wiki/…
    – MBu
    May 28, 2013 at 19:16
  • +1 for the clearing what the "stop task if it runs longer than " really does. That is - if you say "stop after 5 hours", those "5 hours" are about the complete task length, together with all of its repetitions. And not about the duration of just one action trigger, that is - not about one repetition.
    – userfuser
    Sep 28, 2017 at 9:27
1

The duration specifies how long you want to keep repeating the task. Set the duration to 23 hours and 59 minutes and your task will repeat every 30mins for the duration of an entire day. http://support.microsoft.com/kb/814596

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .