I have a Scheduled Task running on a Windows 2008 R2 server.
The task calls a .bat file that performs a file copy.
Everything works perfectly except for one thing. I want the task to terminate if it takes longer than a certain period of time. When I enable 'Stop the task if it runs longer than:' (in the Settings tab) and enter a time limit, this just gets ignored. To test whether the stop works, I have added a delay in the batch file to cause it to sleep for a while.
The task is configured to run as a local user (not the administrator) and as mentioned earlier, everything works perfectly except for the termination of the job if it takes too long to run.
Any help would be hugely appreciated!
Does the task sxheduler actually show stopped, but the process is still running? If so you might need to redo your script so it doesn't shell out to another process that isn't under the control of task scheduler. Some processes get stuck trying to be terminated. But a simple file copy should be easy enough for task scheduler to kill.