{"id":2091,"date":"2013-09-30T22:29:43","date_gmt":"2013-09-30T22:29:43","guid":{"rendered":"http:\/\/www.atumvirt.com\/?p=2091"},"modified":"2013-09-30T22:29:43","modified_gmt":"2013-09-30T22:29:43","slug":"discover-what-citrix-director-wont-show-you-which-usermachine-had-long-log-on-duration-in-xendesktop-7","status":"publish","type":"post","link":"https:\/\/avtempwp.azurewebsites.net\/2013\/09\/discover-what-citrix-director-wont-show-you-which-usermachine-had-long-log-on-duration-in-xendesktop-7\/","title":{"rendered":"Discover What Citrix Director Won’t Show You: Which User\/Machine Had Long Log on Duration in XenDesktop 7"},"content":{"rendered":"

Citrix Director is great for showing you trends for logon performance, but you can’t yet “drill down” to determine\u00a0which<\/strong> user specifically had the long log on duration. \u00a0Luckily enough, the SQL database does have this information. \u00a0The query below will show you all logons from the current day and sort them by LogOnDuration.<\/p>\n

 <\/p>\n

SELECT MonitorData.Session.StartDate, MonitorData.Session.LogOnDuration, MonitorData.Session.EndDate, MonitorData.Session.ExitCode, \n MonitorData.Session.FailureDate, MonitorData.Session.ConnectionState, MonitorData.Session.ConnectionStateChangeDate, MonitorData.Machine.DnsName, \n MonitorData.Machine.HostingServerName, MonitorData.Machine.HostedMachineName, MonitorData.[User].Upn\nFROM MonitorData.Session INNER JOIN\n MonitorData.[User] ON MonitorData.Session.UserId = MonitorData.[User].Id INNER JOIN\n MonitorData.Machine ON MonitorData.Session.MachineId = MonitorData.Machine.Id\nWHERE (CONVERT(varchar(10), MonitorData.Session.StartDate, 102) = CONVERT(varchar(10), GETDATE(), 102)) AND (MonitorData.Session.LogOnDuration > 0)\nORDER BY MonitorData.Session.LogOnDuration DESC<\/pre>\n

Alternatively, you can use this query for a more streamlined output with key data – Machine name, username, logon time (in seconds) with local time rather than UTC<\/p>\n

SELECT CONVERT(datetime,switchoffset(convert(datetimeoffset,MonitorData.Session.StartDate),datename(tzoffset,sysdatetimeoffset()))) as StartDateLocalTime,cast((cast(MonitorData.Session.LogOnDuration as decimal(8,2))\/1000.0) as decimal(8,2)) as LogOnDurationSeconds, MonitorData.Machine.DnsName, \n MonitorData.Machine.HostingServerName, MonitorData.Machine.HostedMachineName, MonitorData.[User].Upn\nFROM MonitorData.Session INNER JOIN\n MonitorData.[User] ON MonitorData.Session.UserId = MonitorData.[User].Id INNER JOIN\n MonitorData.Machine ON MonitorData.Session.MachineId = MonitorData.Machine.Id\nWHERE (CONVERT(varchar(10), MonitorData.Session.StartDate, 102) = CONVERT(varchar(10), GETDATE(), 102)) AND (MonitorData.Session.LogOnDuration > 0) and EndDate IS NULL\norder by StartDateLocalTime desc<\/pre>\n","protected":false},"excerpt":{"rendered":"

Citrix Director is great for showing you trends for logon performance, but you can’t yet “drill down” to determine\u00a0which user specifically had the long log on duration. \u00a0Luckily enough, the SQL database does have this information. \u00a0The query below will show you all logons from the current day and sort them by LogOnDuration.   SELECT […]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[10,1,77],"tags":[86,122],"_links":{"self":[{"href":"https:\/\/avtempwp.azurewebsites.net\/wp-json\/wp\/v2\/posts\/2091"}],"collection":[{"href":"https:\/\/avtempwp.azurewebsites.net\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/avtempwp.azurewebsites.net\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/avtempwp.azurewebsites.net\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/avtempwp.azurewebsites.net\/wp-json\/wp\/v2\/comments?post=2091"}],"version-history":[{"count":0,"href":"https:\/\/avtempwp.azurewebsites.net\/wp-json\/wp\/v2\/posts\/2091\/revisions"}],"wp:attachment":[{"href":"https:\/\/avtempwp.azurewebsites.net\/wp-json\/wp\/v2\/media?parent=2091"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/avtempwp.azurewebsites.net\/wp-json\/wp\/v2\/categories?post=2091"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/avtempwp.azurewebsites.net\/wp-json\/wp\/v2\/tags?post=2091"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}