Old Tasks will not Delete - no delete option in the right-click menu
search cancel

Old Tasks will not Delete - no delete option in the right-click menu

book

Article ID: 172958

calendar_today

Updated On:

Products

Task Server IT Management Suite Client Management Suite

Issue/Introduction

The customer is trying to delete old tasks from his SMP Console. However, there is not right-click>delete option.

Environment

ITMS 8.x

Cause

This is due to orphaned instances of the task remaining in the database.

Resolution

To ensure full deletion, walk through these steps:

  1. On the main window for the task, click on one of the scheduled instances shown, and then press Ctrl + A.
  2. Click the red delete X icon and choose to delete all the instances. If there are a lot of instances, it will tell you that the deletion will happen asynchronously.
  3. Right-click on the task and choose Properties. Copy the GUID under the General tab (last field) for use in the following queries.
  4. Open SQL Studio Manager and open a Query window.
  5. Run the following query, and replace <GUID> with the GUID copied above:
    INSERT INTO ItemToDelete
    VALUES ('<Guid>', GETDATE())
  6. Run the following query, and replace <Guid> with the same GUID copied above:
    SELECT    TaskVersionGuid
                        FROM  [dbo].[ItemVersions]            iv
                        JOIN  [dbo].[TaskInstancesIncomplete] ti ON iv.VersionGuid = ti.TaskVersionGuid
                        WHERE iv.ItemGuid = '<Guid>'
                        AND   ISNULL(ti.InstanceStatus, 0) IN (0, 1, 4)
  7. Take the GUID that is returned in the above query and run the following query:
    DELETE FROM TaskInstancesIncomplete
                        WHERE TaskVersionGuid = '<Guid>'
  8. In Microsoft's Task Scheduler, find and run the NS.Quarter Hour schedule.
  9. The task will now be deleted. Repeat for other tasks as necessary.

 

If the above steps didn't work for you, please refer to KB 162337  "Unable to load or delete corrupted tasks"