Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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?

share|improve this question
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 '13 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 '13 at 13:14
    
@mfinni found it –  John May 28 '13 at 13:25
add comment

4 Answers

up vote 2 down vote accepted

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.

share|improve this answer
add comment

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).

share|improve this answer
    
+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 '13 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 '13 at 19:16
add comment

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.

share|improve this answer
add comment

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

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.