1 Reply Latest reply on Aug 24, 2015 7:06 AM by nick.evans

    Cannot delete Scheduled Task (v9.6SP2)

    Apprentice

      As I left-click to highlight the task, the right pane is unresponsive - as in it does not show the usual task status bars.  Also when I'm in the All Task group folder, right-clicking and Delete of the task doesn't seem to do anything...

       

      I have full LANDESK Administrator rights.  I have also tried stopping the LANDESK Scheduler Service and tried deleting, but it still yields the same result.

        • 1. Re: Cannot delete Scheduled Task (v9.6SP2)
          nick.evans SupportEmployee

          Hi Rocfob,

          It sounds like your task has likely became disassociated from certain tables in your DB. Below is a query that can be used to remove scheduled tasks.

          Before running any queries against your DB, always make a full backup as a safety precaution.

           

          First identify the LD_TASK_IDN value of the specific scheduled task.

           

          Run this query against your LDMS database:

          Select * 
          From [dbo].[LD_TASK] 
          

           

          This will return all Scheduled Tasks that there is a record for.Locate the task based on its TASK_NAME, and find the corresponding LD_TASK_IDN. The LD_TASK_IDN value will be used in the query to remove the record. 1-find id.png

              Delete the Record

          Run the following query, replacing the ### with the LD_TASK_IDN located in step 1.Replace [your db name] with the name of your database, including the brackets.


          DECLARE @TaskID CHAR(20) 
          
          SET @TaskID = '###' 
          
          delete from [your db name].[dbo].[LD_TASK_MACHINE] WHERE LD_TASK_IDN = @TaskID 
          delete from [your db name].[dbo].[DistributionTaskLog] WHERE LD_Task_Idn = @TaskID 
          delete from [your db name].[dbo].[TaskBnfMacros] WHERE LD_TASK_IDN = @TaskID 
          delete from [your db name].[dbo].[TaskFiles] WHERE LD_TASK_IDN = @TaskID 
          delete from [your db name].[dbo].[ApmCommandLines] WHERE LD_TASK_IDN = @TaskID 
          delete from [your db name].[dbo].[ApmTaskObjects] WHERE LD_TASK_IDN = @TaskID 
          delete from [your db name].[dbo].[LD_TASK_USER] WHERE LD_TASK_IDN = @TaskID 
          delete from [your db name].[dbo].[ScheduledQueries] WHERE LD_TASK_IDN = @TaskID 
          delete from [your db name].[dbo].[TaskAllowedMachines] WHERE LD_TASK_IDN = @TaskID 
          delete from [your db name].[dbo].[TaskContent] WHERE LD_TASK_IDN = @TaskID 
          delete from [your db name].[dbo].[TaskPolicy] WHERE LD_TASK_IDN = @TaskID 
          delete from [your db name].[dbo].[LD_TASK] WHERE LD_TASK_IDN = @TaskID 
          

           

          Example:

          DECLARE @TaskID CHAR(20)  
            
          SET @TaskID = '54 '  
            
          delete from [LDMS-DB].[dbo].[LD_TASK_MACHINE] WHERE LD_TASK_IDN = @TaskID  
          delete from [LDMS-DB].[dbo].[DistributionTaskLog] WHERE LD_Task_Idn = @TaskID  
          delete from [LDMS-DB].[dbo].[TaskBnfMacros] WHERE LD_TASK_IDN = @TaskID  
          delete from [LDMS-DB].[dbo].[TaskFiles] WHERE LD_TASK_IDN = @TaskID  
          delete from [LDMS-DB].[dbo].[ApmCommandLines] WHERE LD_TASK_IDN = @TaskID  
          delete from [LDMS-DB].[dbo].[ApmTaskObjects] WHERE LD_TASK_IDN = @TaskID  
          delete from [LDMS-DB].[dbo].[LD_TASK_USER] WHERE LD_TASK_IDN = @TaskID  
          delete from [LDMS-DB].[dbo].[ScheduledQueries] WHERE LD_TASK_IDN = @TaskID  
          delete from [LDMS-DB].[dbo].[TaskAllowedMachines] WHERE LD_TASK_IDN = @TaskID  
          delete from [LDMS-DB].[dbo].[TaskContent] WHERE LD_TASK_IDN = @TaskID  
          delete from [LDMS-DB].[dbo].[TaskPolicy] WHERE LD_TASK_IDN = @TaskID  
          delete from [LDMS-DB].[dbo].[LD_TASK] WHERE LD_TASK_IDN = @TaskID 
          

           

          Once ran, an output in the Messages box should appear. Not all rows will necessarily have been affected. If the query runs, the scheduled task should no longer be displayed in the GUI.

           

          2-result.png