Help creating a SQL report for user logon and logoff times for specific OU
Created: 31 Jan 2013 • Updated: 01 Feb 2013 | 7 comments
This issue has been solved. See solution.
I've been trying to create a SQL query to get a report on user logon and logoff times for a specific OU.
I've tried just about everything and I'm out of ideas.
I've got this to get the logon report:
SELECT DISTINCT T1.[Guid] AS 'Guid',
T1.[Name] AS 'Name',
T0.[Event] AS 'Event',
T0.[User] AS 'User',
T0.[Domain] AS 'Domain',
T0.[Time] AS 'Time'
FROM [vResourceEx] T1
INNER JOIN [Evt_AeX_Client_LogOn] T0 ON T1.[Guid] = T0.[_ResourceGuid]
WHERE T1.[ResourceTypeGuid] = '493435F7-3B17-4C4C-B07F-C23E7AB7781F'
AND T1.[IsManaged] = 1
AND CONVERT(CHAR(10),T0.[Time],101) BETWEEN '01/31/2013' AND '01/31/2013'
AND CONVERT(CHAR(10),T0.[Time],114) BETWEEN '00:00' AND '23:59'
ORDER BY T0.[Time] ASC
But I need to only do the report on a certain OU. Any help would be appreciated.