Run once scheduled used in Tasks and Jobs are not automatically removed
search cancel

Run once scheduled used in Tasks and Jobs are not automatically removed

book

Article ID: 164639

calendar_today

Updated On:

Products

IT Management Suite Task Server

Issue/Introduction

Tasks and Jobs that are scheduled to run at a single time with no repeating schedule are not removed.  This can become a burden in the Windows Task Scheduler and clutter the results of tasks and jobs.

Schedule occurs in the past

Environment

7.5-8.0

Cause

This was never implemented as a feature of the product and is working as designed.

Resolution

Symantec developement is evaluating this again and will implement a cleanup process at some point in the future.

As a work around the following SQL Query can be run on a schedule through an SQL Server Task in the SMP Console or any other available means.  This will cause schedules that do not repeat and only exist in the past to be removed.

insert into ItemToDelete
select a.Guid, GETDATE ()
--select *
from
(
select
CAST (i.State as xml).value('(item/scheduling/schedule/trigger/@type)[1]', 'nvarchar (200)') as ScheduleType,
cast (substring (CAST (i.State as xml).value('(item/scheduling/schedule/@start)[1]', 'nvarchar (200)'), 0, 20) as datetime) as ScheduleTime,
CAST (i.State as xml) statexml,
i.Name,
i.Guid
from Item i
join ItemClass ic on ic.Guid = i.Guid
join Class c on c.Guid = ic.ClassGuid
Where c.Guid = '2C8D08C3-A9BA-4E39-A6EA-08701FBA4A6E'--Altiris.TaskManagement.UI.TaskSchedule
) a
where a.ScheduleType = 'Once'
and a.ScheduleTime < GETDATE ()