Last logged on User SQL report

SELECT v_GS_SYSTEM.Name0 AS ComputerName, v_GS_SYSTEM.Domain0 AS [Logon Domain], v_GS_SYSTEM.SystemRole0 AS [System Role],
v_GS_SYSTEM.SystemType0 AS [System Type], v_GS_COMPUTER_SYSTEM.UserName0 AS [Logon User],
v_GS_COMPUTER_SYSTEM.TimeStamp AS [Last Loggedin Time]
FROM v_GS_SYSTEM INNER JOIN
v_GS_COMPUTER_SYSTEM ON v_GS_SYSTEM.ResourceID = v_GS_COMPUTER_SYSTEM.ResourceID
WHERE (v_GS_SYSTEM.Name0 = @ComputerName)
ORDER BY ComputerName

Name :ComputerName

Promptname:ComputerName

SQL Statement:

begin
if (@__filterwildcard = ”)
SELECT DISTINCT V_GS_SYSTEM.Name0 from V_GS_SYSTEM ORDER By V_GS_SYSTEM.Name0
else
SELECT DISTINCT V_GS_SYSTEM.Name0 from V_GS_SYSTEM
WHERE V_GS_SYSTEM.Name0 like @__filterwildcard
ORDER By V_GS_SYSTEM.Name0
end

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: