VMware Horizon Community
drews008
Contributor
Contributor

Get-HVEvent not returning all events

When I user PowerCLI to query all events for a specific user, I only get events in the current year. I don't get any events from the previous year.  

 

PowerCLI C:\> $events=Get-HVEvent -HvDbServer $eventdb -TimePeriod all -UserFilter $userName
Number of records found : 373
PowerCLI C:\> $events=Get-HVEvent -HvDbServer $eventdb -UserFilter $userName
Number of records found : 373
PowerCLI C:\> $events.events | select EventTime | Sort-Object Eventtime -desc

... data from today at top and the bottom 2 entries are below ...

01/04/2021 08:07:39.013
01/04/2021 08:07:37.310

But when I query the SQL database using DumpViewEventDBData.exe for the same user I'm able to get data from 2020:

... data from today at top and the bottom 2 entries are below ...

11/19/2020 8:05:07
11/19/2020 4:03:17

When I manually compare the two results I'm getting the same type of information so I'm getting the events I want to see I'm just not getting them far back enough from Get-HVEvent. And I know the data is there because I can get it through SQL commands.

Am I doing something wrong that I'm not getting older data using PowerCLI? I'm trying to create a script to look for users that haven't logged into their VDI system in over 90 days. It would be easier to script this all in PowerCLI but I can't get all the data? Any insight is greatly appreciated. 

This is happening to all users, I only showed one as an example. 

Labels (3)
Reply
0 Kudos
3 Replies
Magneet
Hot Shot
Hot Shot

i'll tell you worse, there's a bug in some horizon versions that causes you not getting any more than 1000. The pagination has been broke for a while already.

drews008
Contributor
Contributor

Yikes, thanks for the info. Guess I'll dust off the SQL queries. 

Reply
0 Kudos
Magneet
Hot Shot
Hot Shot

it's strongly recommended to use sql anyway as the event related api's cause a unreasonable high load on the connection servers

Reply
0 Kudos