VMware Horizon Community
MaxStr
Hot Shot
Hot Shot

Can I see the last login time of a VDI or user?

I'm trying to clear out some unused VDI's. Is there any way I can get a report or information on the last time a user logged in?

0 Kudos
5 Replies
Mickeybyte
Hot Shot
Hot Shot

@MaxStr 

I found the following SQL query in my script repository. Run it on the Events Database:

/*
    List users and their last connection time for all or specific desktop pool
*/

SELECT ModuleAndEventText, MAX(Time) as Time FROM event_historical
       WHERE EventType = 'BROKER_DESKTOP_REQUEST'  /* AND ModuleAndEventText LIKE '%Pool <poolID>%' */
       GROUP BY ModuleAndEventText
       ORDER BY Time desc

 


Regards,
Mickeybyte (ITPro blog)

If you found this comment useful or an answer to your question, please mark as 'Solved' and/or click the 'Kudos' button, please ask follow-up questions if you have any.
VMHero4Ever
Enthusiast
Enthusiast

Hi Mickeybyte,

I tried your sql query on our environment and get all logon events for the last 30 days.
What I want to see is user logon dates which are older than x-days so that I can find user which are orpahned or not active anymore in your enviroment. Any ideas how I can find them?


0 Kudos
Mickeybyte
Hot Shot
Hot Shot

The script actually shows all unique users and their last login time. The results are ordered by descending time, so if you scroll down to e.g. 22/01/2022, any user below that line hasn't logged in in the last 30 days


Regards,
Mickeybyte (ITPro blog)

If you found this comment useful or an answer to your question, please mark as 'Solved' and/or click the 'Kudos' button, please ask follow-up questions if you have any.
0 Kudos
VMHero4Ever
Enthusiast
Enthusiast

Thanks for your reply.
We found a sql cleanup job which deletes all entries older than 30 days 😞

0 Kudos
Mickeybyte
Hot Shot
Hot Shot

Oops... 🙂 


Regards,
Mickeybyte (ITPro blog)

If you found this comment useful or an answer to your question, please mark as 'Solved' and/or click the 'Kudos' button, please ask follow-up questions if you have any.
0 Kudos