Location of last logon user

This query will list most of the place where user name can be determined. Also sometimes I have seen people confuse RegisteredUser0 as the last logon user, this is not the case. This is the Registration name of used for Windows OS.

SELECT
 v_GS_COMPUTER_SYSTEM.Name0,
 v_GS_COMPUTER_SYSTEM.UserName0,
 v_GS_SYSTEM_CONSOLE_USER.SystemConsoleUser0,
 v_GS_SYSTEM_CONSOLE_USAGE.TopConsoleUser0,
 v_GS_SYSTEM_CONSOLE_USAGE_MAXGROUP.TopConsoleUser0,
 v_R_System.User_Name0,
 v_R_System_Valid.User_Name0,
 v_GS_OPERATING_SYSTEM.RegisteredUser0
FROM
 dbo.v_GS_COMPUTER_SYSTEM v_GS_COMPUTER_SYSTEM,
 dbo.v_GS_OPERATING_SYSTEM v_GS_OPERATING_SYSTEM,
 dbo.v_GS_SYSTEM_CONSOLE_USAGE v_GS_SYSTEM_CONSOLE_USAGE,
 dbo.v_GS_SYSTEM_CONSOLE_USAGE_MAXGROUP v_GS_SYSTEM_CONSOLE_USAGE_MAXGROUP,
 dbo.v_GS_SYSTEM_CONSOLE_USER v_GS_SYSTEM_CONSOLE_USER,
 dbo.v_R_System v_R_System,
 dbo.v_R_System_Valid v_R_System_Valid
WHERE
 v_GS_OPERATING_SYSTEM.ResourceID = v_GS_COMPUTER_SYSTEM.ResourceID
 AND v_GS_SYSTEM_CONSOLE_USER.ResourceID = v_GS_COMPUTER_SYSTEM.ResourceID
 AND v_GS_SYSTEM_CONSOLE_USAGE.ResourceID = v_GS_COMPUTER_SYSTEM.ResourceID
 AND v_GS_SYSTEM_CONSOLE_USAGE_MAXGROUP.ResourceID = v_GS_COMPUTER_SYSTEM.ResourceID
 AND v_R_System.ResourceID = v_GS_COMPUTER_SYSTEM.ResourceID
 AND v_R_System_Valid.ResourceID = v_GS_COMPUTER_SYSTEM.ResourceID

Leave a Reply

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