Connection (Session) Duration Report: Best Solution for VMware Horizon View 7.x or Newer
VMware Horizon View provides solutions for remote working and access to business from anywhere. Users be able to use virtual desktop or applications via secure and fast display protocols such as PCoIP or VMware Blast. VMware did support monitoring VMware Horizon View via vRealize Operations (vROps) for Horizon but recent versions are not supported. You have to use third-party software or services such as ControlUp or develop your solutions.
I had to choose second choice and developed the solution by PowerShell, also you can use it with considering some conditions.
What Are Conditions?
If you want to use this PowerShell script, you must aware that:
- Users should have at least one “Connect” or “Disconnect” or “Reconnect” during past 24 hours (00:00 – 23:59:59).
- If user just has one “Connect”, the duration will be calculated from “Connect” event time till end of day. If user just has one “Disconnect”, the duration will be calculated from begin of day till “Disconnect” time.
- Idle session duration couldn’t be detecting.
- PowerShell script analyze result of SQL query and you can change the query as you wish.
What’s Data Source?
The data source is VMware Horizon View event database, so you should have it and configure it on Connection servers.
The Script for Generate Connection Duration Report
Change the below values with something that you want or you have:
- DOMAIN: Change it with your domain name.
- domain.org: Change it with your domain FQDN.
- Session Type: Desktop is default but you can remove it or add another condition to that.
- Output File Address: The last line must be changed.
How To Run?
You can run the script on database server locally but if you want to run from remote computer, you should do some changes on script.
My favorite: SQL Server Agent Job (You should make sure about permission on target folder)
Further Reading
Using Client Information in VMware View
Linked-Clone Virtual Machine Without VMware Horizon View
Add existing virtual desktops to “Automated Pool” in VMware View manually
First I have to say that is a awesome PowerShell script you put together. I was able to enter our VDI info and pull some data from it.
Quick question, how do modify the script to include historical data? Would it be possible to modify it to show at least the previous week/month? How would I go about doing that. I am not too well versed in PowerShell scripting but I am trying to learn more about it.
Thanks for any help you can provide.
Thank you Ronaldo for your comment.
The script has been prepared for session duration calculation during past 24 hours.
The date will be collected from host server (PowerShell running on it) and you can change date of SQL query, BeginDay and EndDay as well.
About week and month, I have to write another script.