Client Management Suite

 View Only
  • 1.  AWOL Machine Report - need to filter out retired assets

    Posted Aug 21, 2013 12:37 PM

    Hey guys, thanks in advance for any help. I found an AWOL machine reporton Connect a while back that we have been using but I noticed it includes retired assets. I was curious if anyone had any idea on what I could do to make sure that only active/non-retired machines showed up in this report. The sql for this is below:

     

    DECLARE @days int
    SET @days = 14
    SELECT ci.[Guid]
    , ci.[Name]
    , ISNULL(ir.[Collection Time], eh.[LastInvEvt]) [Last Inventory]
    FROM vRM_Computer_Item ci
    LEFT OUTER JOIN Inv_Inventory_Results ir
     ON ci.[Guid] = ir.[_ResourceGuid]
     AND ir.[Agent] = 'Inventory Agent'
    LEFT OUTER JOIN (
     SELECT MAX(_eventTime) [LastInvEvt], [ResourceGuid]
     FROM Evt_NS_Event_History
     WHERE ItemName = 'Inventory Solution Capture Item'
     GROUP BY ResourceGuid
     ) eh ON eh.[ResourceGuid] = ci.[Guid]
    WHERE DATEADD(DAY, @days, ISNULL(ir.[Collection Time],ISNULL(eh.[LastInvEvt],''))) < GETDATE()
     AND ci.[IsManaged] = 1
    ORDER BY ci.[Name] ASC

     

     

     

    Thanks again!!!



  • 2.  RE: AWOL Machine Report - need to filter out retired assets
    Best Answer

    Posted Aug 22, 2013 11:50 AM

    Sure, here you go...

    -------

     

    DECLARE @days int
    SET @days = 1
    SELECT ci.[Guid]
    , ci.[Name]
    , ISNULL(ir.[Collection Time], eh.[LastInvEvt]) [Last Inventory]
    FROM vRM_Computer_Item ci
    JOIN vAsset va ON va._ResourceGuid = ci.[Guid]
    LEFT OUTER JOIN Inv_Inventory_Results ir
     ON ci.[Guid] = ir.[_ResourceGuid]
     AND ir.[Agent] = 'Inventory Agent'
    LEFT OUTER JOIN (
     SELECT MAX(_eventTime) [LastInvEvt], [ResourceGuid]
     FROM Evt_NS_Event_History
     WHERE ItemName = 'Inventory Solution Capture Item'
     GROUP BY ResourceGuid
     ) eh ON eh.[ResourceGuid] = ci.[Guid]
    WHERE DATEADD(DAY, @days, ISNULL(ir.[Collection Time],ISNULL(eh.[LastInvEvt],''))) < GETDATE()
     AND ci.[IsManaged] = 1
     AND va."Status" = 'Active'
    ORDER BY ci.[Name] ASC
     


  • 3.  RE: AWOL Machine Report - need to filter out retired assets

    Posted Aug 22, 2013 11:52 AM

    I Joined the view VAsset which has Machines Statues, and added at the bottom to only return machines whose status = Active. 



  • 4.  RE: AWOL Machine Report - need to filter out retired assets

    Posted Aug 22, 2013 12:04 PM

    Huge help thank you!!