What is the criteria for Purging Maintenance to function correctly?
IT Management Suite (ITMS) 8.x.
The criteria for Purging Maintenance is:
The following SQL query is taken from the logic used by "spGetComputersToPurge", but modified to show useful information other than Guid :
Note: This is based on a purge setting of 60 days or greater without the client checking in to update its client date.
declare @purgeSetting int
set @purgeSetting = 60
select c.Guid, c.Name, dt.LatestInventoryDate, DATEDIFF(dd,dt.LatestInventoryDate,getdate()) as [Days since last update]
from vComputer c --Must be Active and not deleted
JOIN
( select [ResourceGuid], max([ModifiedDate]) as LatestInventoryDate
from dbo.ResourceUpdateSummary
where InventoryClassGuid = '9E6F402A-6A45-4CBA-9299-C2323F73A506'--Inv_AeX_AC_Client_Agent
group by [ResourceGuid]
) as dt ON c.Guid = dt.ResourceGuid
where c.IsManaged = 1
and DATEDIFF(dd,dt.LatestInventoryDate,GETDATE()) >= @purgeSetting
The following query will show all computers that have no client date and therefore will never be purged:
declare @purgeSetting int
set @purgeSetting = 60
select c.Guid, c.Name, c.CreatedDate, DATEDIFF(dd,c.CreatedDate,getdate()) as [Days Old]
from vComputer c --Must be Active and not deleted
LEFT JOIN
( select [ResourceGuid], max([ModifiedDate]) as LatestInventoryDate
from dbo.ResourceUpdateSummary
where InventoryClassGuid = '9E6F402A-6A45-4CBA-9299-C2323F73A506'--Inv_AeX_AC_Client_Agent
group by [ResourceGuid]
) as dt ON c.Guid = dt.ResourceGuid
where dt.ResourceGuid is null
and DATEDIFF(dd,c.CreatedDate,GETDATE()) >= @purgeSetting
order by 4 desc
As previously stated, the computers returned by the previous query will not be purged because they have no client date information. If it is desired to get rid of computers that are a certain number of days old but won't be touched by Purging Maintenance, attached to this article is a task that can be imported (under "Manage > Jobs and Tasks") which will insert those computers to be deleted within 15 minutes, or after the 'NS.Quarter hour' schedule task is run.
This task is also based on a 60 day purge setting, but can be manually changed after import.