Advertisement
easternnl

Citrix - Query database for detailed logon times

Nov 30th, 2015
1,475
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
SQL 1.69 KB | None | 0 0
  1. /* Citrix Director only gives Average information about logon. This query gives detailed and calculated information about the logontimes. */
  2.  
  3. /****** Script for SelectTopNRows command from SSMS  ******/
  4. SELECT LogonDuration = DATEDIFF(SECOND, [LogOnStartDate], [LogOnEndDate])
  5.       ,[BrokeringDuration]
  6.       ,[AuthenticationDuration]
  7.       ,GpoDuration = DATEDIFF(SECOND, [GpoStartDate], [GpoEndDate])
  8.       ,InteractiveDesktop = DATEDIFF(SECOND, [BrokeringDate],[InteractiveEndDate])
  9.       ,FORMAT([BrokeringDate] , 'dd-MM-yyyy') AS EasyDate
  10.       ,FORMAT([BrokeringDate] , 'HH') AS EasyHour
  11.       ,[Name] AS VM
  12.       ,[ClientName]
  13.       ,[ClientAddress]
  14.       ,[ClientVersion]
  15.       ,[ConnectedViaHostName]
  16.       ,[ConnectedViaIPAddress]
  17.       ,[LaunchedViaHostName]
  18.       ,[LaunchedViaIPAddress]    
  19.       ,[LogOnStartDate]
  20.       ,[LogOnEndDate]
  21.       ,[BrokeringDuration]
  22.       ,[BrokeringDate]
  23.       ,[DisconnectCode]
  24.       ,[DisconnectDate]    
  25.       ,[ClientSessionValidateDate]
  26.       ,[ServerSessionValidateDate]
  27.       ,[EstablishmentDate]    
  28.       ,[AuthenticationDuration]
  29.       ,[GpoStartDate]
  30.       ,[GpoEndDate]
  31.       ,[LogOnScriptsStartDate]
  32.       ,[LogOnScriptsEndDate]
  33.       ,[ProfileLoadStartDate]
  34.       ,[ProfileLoadEndDate]
  35.       ,[InteractiveStartDate]
  36.       ,[InteractiveEndDate]    
  37.   FROM [MonitorData].[Connection]
  38.   LEFT JOIN [MonitorData].[SESSION]
  39.   ON ([MonitorData].[Connection].[SessionKey] = [MonitorData].[SESSION].[SessionKey] )
  40.   LEFT JOIN [MonitorData].[Machine]
  41.   ON ([MonitorData].[SESSION].[MachineId] = [MonitorData].[Machine].[Id])
  42.  
  43.  
  44.   WHERE CONVERT(DATE,[LogOnStartDate]) = CONVERT(DATE,GETDATE())
  45.             AND [IsReconnect] = 0
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement