How can we find the Last Logged on User and the last logon time

book

Article ID: 158892

calendar_today

Updated On:

Products

Altiris Software Development Kit (ASDK)

Issue/Introduction

If we wanted to know the Last logged in user (Primary user) and its logon time then we can create a custom SQL report with the below query

Resolution

 SELECT DISTINCT

i.Name, i.[User], max(logon.time) as [logon time], i.[OS Name], i.[OS Revision], i.[System Type],

vhw.[Manufacturer],

vhw.[Model],

hwc.[Serial Number], hwc.[Chassis Package Type]

FROM dbo.vComputer i

INNER JOIN vHWComputerSystem vhw ON vhw._ResourceGuid = i.Guid

INNER JOIN Inv_HW_Chassis hwc ON vhw._ResourceGuid = hwc._ResourceGuid

JOIN dbo.Evt_AeX_CLient_Logon logon on i.Guid = logon._ResourceGuid

WHERE i.[System Type] LIKE 'Win%'

AND LOWER (i.[Name]) LIKE LOWER ('%%')

AND LOWER (vhw.[model]) LIKE LOWER ('%')

GROUP BY i.Name, i.[User], i.[OS Name], i.[OS Revision], i.[System Type],

vhw.[Manufacturer],

vhw.[Model],

hwc.[Serial Number], hwc.[Chassis Package Type]


Applies To

 Inventory Solution 7.x