Find Dormant Scheduled Tasks

Version 1

    So if your shop is like mine you have a lot of Scheduled tasks. Managing these tasks can be arduous at times, and cleaning up old tasks can be cumbersome. The following SQL script will show Scheduled Tasks that have no activity (targets have not ran the task) in X days. The code listed below uses a 180 day threshold - (getdate()-180) Change this to whatever threshold works in your shop.  Consider this as started code that you can add on to....

     

    SELECT LD_TASK_MACHINE.LD_TASK_IDN,LD_TASK.TASK_NAME,MAX (LD_TASK_MACHINE.STATUS_TIME) as "Last Target Ran On"
    FROM LD_TASK_MACHINE
    
    JOIN LD_TASK
    ON LD_TASK_MACHINE.LD_TASK_IDN=LD_TASK.LD_TASK_IDN
    
    GROUP By LD_TASK_MACHINE.LD_TASK_IDN,LD_TASK.TASK_NAME
    HAVING MAX (LD_TASK_MACHINE.STATUS_TIME) < (getdate()-180) 
    Order by LD_TASK.TASK_NAME
    
    

     

    As always,  check these tasks in the Console before taking any action. There may be a very good reason for the Scheduled Task to dormant