Last logon User query

Remeber that I don’t use the v_R_system views to determine the last logon user and here is why.

http://smsug.ca/blogs/garth_jones/archive/2007/03/22/224.aspx

http://smsug.ca/blogs/garth_jones/archive/2007/03/23/225.aspx

SELECT  GS.Name0,
GS.UserName0,
WS.LastHWScan,
GS.Domain0,
OS.Caption0,
SYS.SystemRole0
FROM
v_GS_COMPUTER_SYSTEM GS,
v_GS_OPERATING_SYSTEM OS,
v_GS_SYSTEM SYS,
v_GS_WORKSTATION_STATUS WS
WHERE
GS.ResourceID = SYS.ResourceID
AND WS.ResourceID = GS.ResourceID
AND OS.ResourceID = GS.ResourceID
AND SYS.SystemRole0<>’Server’
AND Datediff(dd,WS.LastHWScan,getdate()) > -1
AND (GS.Domain0 = ‘gartek.tst’
OR GS.Domain0 = ‘Doghouse’)

Leave a Reply

Your email address will not be published. Required fields are marked *