search cancel

Purging Maintenance is not purging computer resources as expected

book

Article ID: 163954

calendar_today

Updated On:

Products

IT Management Suite

Issue/Introduction

What is the criteria for Purging Maintenance to function correctly?

Environment

IT Management Suite (ITMS) 7.x, 8.x.

Resolution

The criteria for Purging Maintenance is:

  1. That it must be active or at least not set to deleted.
  2. It must have been "managed" at one time and not just discovered. It is tracked in ResourceUpdateSummary by the modifiedDate in dataclass "Inv_Aex_AC_Client_Agent". 

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 =

   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.

Attachments

Delete Non Managed or non functioning comuters older than N days.zip get_app