Hello.
I stumbled upon Get-SCPerformanceData cmdlet while trying to retrieve VM CPU performance history.
I've ran this:
Get-SCPerformanceData -VM $vm -PerformanceCounter CPUUsage -TimeFrame Hour
(stored the desired VM in the $vm variable ahead ofcourse)
I was expecting to get the performance data for past HOUR, but when I look at the PerformanceHistory and/or TimeSamples properties of the output, it returns 320 values going back to previous day.
Do I understand the -TimeFrame parameter wrong?
Next, I assume the CPUUsage returns the 'CPU Average' value for the VM (which (should) translates to “%Guest Run Time” counter of “Hyper-V Hypervisor Virtual Processor(_Total)” counter set on the Hyper-V host). The TimeSamples property of the Get-SCPerformanceData output shows the data is collected every 9 minutes and does so twice in rapid succession (sometimes it's the same second, sometimes it's 2 seconds). Is this working as it's supposed to? Are these data points already the averages? Or does VMM really only collect the data 2x/9mins??
Also, VMM console describes the average as "Past 10 minutes performance data", while it should be 9 minutes? As was also original described (https://techcommunity.microsoft.com/t5/System-Center-Blog/How-SCVMM-Determines-CPU-Average-Displayed-in-the-Admin-Console/ba-p/341548)
Hyper-V: Hyper-V Server 2016
VMM: VMM 2016 UR7
PS: I've noticed the VMM database has a table tbl_PCMT_PerfHistory_Raw, which I assume contains all values? Is there a way to get the raw data from VMM PSH?