I have a Scheduled Task on a Windows (64-bit) 2008 R12 (SP1) server. It’s a housekeeping task and I was expecting its first run to take some time catching up on backlog of actions , so set what I thought were appropriate “Stop the task if Runs longer than” on both trigger and general settings (including ‘If the running task does not end when requested, force it stop” ).
1st issue – when viewing the Settings Tab in the ‘Task Scheduler Library’ view – it shows the default 3 days as the time-out setting, not my setting (which comes up if go into edit the task).
The Task run shows with Last Run Result = (0x41306)
The Task History shows
Level Date and Time Event ID Task Category Operational Code Information 30/11/2014 19:40:03 329 Task stopping due to timeout reached Info Information 30/11/2014 19:40:03 111 Task terminated Termination Information 30/11/2014 07:40:02 129 Created Task Process Info Information 30/11/2014 07:40:02 100 Task Started (1)
… i.e. the “Stop the task if Runs longer than” did kick in ..
The Windows Application Log shows
Level Date and Time Source Event ID Task Category Warning 30/11/2014 19:45:03 User Profile Service 1530 None Warning 30/11/2014 19:45:03 User Profile Service 1530 None Of nature “Windows detected your registry file is still in use by other applications or services. The file will be unloaded now. The applications or services that hold your registry file may not function properly afterwards. DETAIL - 2 user registry handles leaked from \Registry\User\S-1-5-21-934353228-948777034-184960113-61974_Classes: Process 2536 (\Device\HarddiskVolume2\Windows\System32\cscript.exe) has opened key \REGISTRY\USER\S-1-5-21-934353228-948777034-184960113-61974_CLASSES …”
Note: 5 mins after the termination (attempt) ; that SID being the account the task was running under.
However the task itself which creates and maintains its own log did not finish until a lot later, appearing to complete successfully.
So more issues: The History isn’t giving a sensible report; the last entry has Task category = “Task terminated” but it clearly didn’t ( at least not at the indicated date and time ). The last run result code – nothing to indicate whether this related to the task itself or the failure to terminate. What can I do to get the task termination effort to be effective ?
The task is a vbs script, run using
cscript //b //nologo scriptname .