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.

In the Settings tab of a Task in Task Scheduler Windows 2008 and Win8 you can specify additional settings that affect the behavior of your task.

The setting for "Stop the task if it runs longer than:" only allows as low as 1 hour but is there any other way to specify in minutes effectively terminating my job if it runs long than 15 minutes?

Thanks.

share|improve this question

1 Answer 1

enter image description hereYou can specify a duration in minutes from the command line using "schtasks /create". The /DU option allows for HH:mm So you should be able to set it for 15 minutes if needed.

share|improve this answer
    
That /DU option seems to be related to the duration of the repetition interval and not the termination. The different tests I created at the command line never changed the "Stop Task If Runs X Hours and X Mins" setting (schtasks /query /fo LIST /v /tn test). I tested with a simple test but was unsuccessful: schtasks /create /tn test /du 00:01 /k /tr "ping.exe 127.0.0.1 -t" –  Mouffette May 11 '12 at 6:23
    
According to "schtasks /create /?" the /DU option "Specifies the duration to run the task." –  MikeAWood May 11 '12 at 20:36
    
I had a few options to your example to get it to accept it into the scheduler. But it does work and shows "2 Minutes as the duration". See the pic I added above. The command I used was [schtasks /create /tn test /du 00:02 /k /tr "ping 127.0.0.1 -t" /SC once /ST 13:35 /RI 1] –  MikeAWood May 11 '12 at 20:43
    
Also, it appears that the GUI will let you manuall type in "1 Minute" into the duration drop down. I noticed that after i posted the above. So you probably can more easily just change it from the GUI, but keep in mind the duration time needs to be shorter than the repetition inverval (even if only running once). –  MikeAWood May 11 '12 at 20:45
    
Thanks Mike but this is the wrong part of the UI, I'm trying to change the "Stop the task if it runs longer than". My task runs daily at 1 a.m. and i'm trying to kill the task if it runs for > 15 minutes. /DU refers to duration of the repetition of the task not how long the task process itself runs for. –  Mouffette May 12 '12 at 2:37

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.