This message was deleted.
# citrix-vad
s
This message was deleted.
r
@Webster Webster what magic do you have in your 50 years of experince?
👍 1
w
None for that. And it is 45 years! Don't make me older than I already am. 🙂 Check with @Guy Leech
r
Oh 45 years. I was close. Ok thanks I will ask Guy
@Guy Leech Any chance you have something like this?
I really dislike Citrix Director. CU for the WIN HERE. Can I get a AMEN on that?
g
Not sure if the OData interface gives the level of detail. There's a script here which can be used to query the various tables available for query https://github.com/guyrleech/Citrix/blob/master/Get%20Citrix%20OData%20data.ps1
r
Thanks Guy. I forgot about your blog site as well. That has a good bit of scripts. Thank you though for replying.
👍 1
Ok, they explained things to me better. Long story short, they are wanting to see the idle vs active sessions for a user. They need to know when they are away vs working in a session.
h
In the monitoring DB under the sessions table there is a session state change timestamp. That may be what you are looking for
r
Ok, thanks Hal. I will take a look at that.
h
here are some example queries to get real names, appname, dg name, etc...
Copy code
/*This will get sessions for last 90 days
it will get the following columns
Username, Client IP Address, Client Platform, ClientName, Session Start Date/Time (in local Time), Session End Date/Time (in local time), VDA machine Name, DesktopGroup Name,
*/
Select     
    [User].UserName,
    [connection].ClientAddress,
    [connection].ClientPlatform,
    [connection].clientname,
    DATEADD(mi, DATEDIFF(mi, GETUTCDATE(), GETDATE()), [Session].StartDate) as StartDate_LocalTime,
    DATEADD(mi, DATEDIFF(mi, GETUTCDATE(), GETDATE()), [Session].EndDate) as EndDate_LocalTime, 
    [Machine].HostedMachineName,
    [DesktopGroup].Name
from (((([MonitorData].[Session]     
inner join [MonitorData].[User] On [MonitorData].[User].ID = [MonitorData].[Session].UserID)
inner join [MonitorData].[Connection] on [MonitorData].[Session].Sessionkey = [MonitorData].[Connection].Sessionkey)
inner join [MonitorData].[Machine] on [MonitorData].[Session].MachineID = [MonitorData].[Machine].ID)
inner join [MonitorData].[DesktopGroup] on [MonitorData].[Machine].DesktopGroupID = [MonitorData].[DesktopGroup].ID)
where StartDate >= dateadd(day,-90,GetUTCDate()) order by StartDate


Select top 1 
    DATEADD(mi, DATEDIFF(mi, GETUTCDATE(), GETDATE()), [Session].StartDate) as StartDate_LocalTime
from [MonitorData].[Session]     
inner join [MonitorData].[User] On [MonitorData].[User].ID = [MonitorData].[Session].UserID
where ((username like '<Username>')) order by StartDate Desc


/*Selects last starttime per user in last 30 days*/
Select t.UserName, Max(t.StartDate_UTC) as LastLogin from (Select    
    [User].UserName,
    [Session].StartDate as StartDate_UTC
from ([MonitorData].[Session]     
inner join [MonitorData].[User] On [MonitorData].[User].ID = [MonitorData].[Session].UserID)
where StartDate >= dateadd(day,-30,GetUTCDate()))t group by UserName order by username asc

/*Shows count per user over last 30 days*/
select [User].UserName, count (*) as TotalSessions
from ([MonitorData].[Session]     
inner join [MonitorData].[User] On [MonitorData].[User].ID = [MonitorData].[Session].UserID)
where  StartDate >= dateadd(day,-30,GetUTCDate()) 
group by UserName

/*shows distinct users that logged in successfully for over 5 min in a timespan*/
select distinct(t1.UserName) from 
(Select     
    [User].UserName,
    [Session].StartDate,
    [Session].EndDate,
	DATEDIFF(mi, [session].startdate, [Session].endDate) as Duration,
    [DesktopGroup].Name
from (((([MonitorData].[Session]     
inner join [MonitorData].[User] On [MonitorData].[User].ID = [MonitorData].[Session].UserID)
inner join [MonitorData].[Connection] on [MonitorData].[Session].Sessionkey = [MonitorData].[Connection].Sessionkey)
inner join [MonitorData].[Machine] on [MonitorData].[Session].MachineID = [MonitorData].[Machine].ID)
inner join [MonitorData].[DesktopGroup] on [MonitorData].[Machine].DesktopGroupID = [MonitorData].[DesktopGroup].ID)
where StartDate >= '2021-07-01 00:15' and EndDate <= '2021-07-01 13:13' and [DesktopGroup].Name like 'DGName%' 
) as t1
where duration > 5
r
Oh wow, Thank you Hal very much.
m
ControlUp can grab this easily if you have access to that, has a nice visual layout of it too
r
Yea, this place I'm helping is behind in the EUC space at the moment. Lots of worked needed and CU is on the list.