No, it doesn't look like it.
This is the output with using $start = (get-date).AddDays(-2)
VmName | Timestamp | vCPU | MinCpu | AvgCpu | MaxCpu | MemAlloc | MinMem | AvgMem | MaxMem |
Server01 | 3/10/2012 9:30 | 1 | 1.38 | 2.03 | 7.14 | 1024 | 6.63 | 9.8 | 35.89 |
This is the output with using $start = (get-date).AddDays(-1)
VmName | Timestamp | vCPU | MinCpu | AvgCpu | MaxCpu | MemAlloc | MinMem | AvgMem | MaxMem |
Server01 | 3/11/2012 9:30 | 1 | 1.38 | 2.07 | 7.14 | 1024 | 6.9 | 10.65 | 35.89 |
$report = @()
$metrics = "cpu.usage.average","mem.usage.average"
$vms = Get-Vm Server01 | where {$_.PowerState -eq "PoweredOn"}
$start = (get-date).AddDays(-1)
Get-Stat -Entity ($vms) -start $start -stat $metrics | `
Group-Object -Property EntityId | %{
$row = ""| Select VmName, Timestamp, vCPU, MinCpu,AvgCpu,MaxCpu,MemAlloc,MinMem,AvgMem,MaxMem
$row.VmName = $_.Group[0].Entity.Name
$row.Timestamp = ($_.Group | Sort-Object -Property Timestamp)[0].Timestamp
$row.vCPU = $_.Group[0].Entity.NumCpu
$cpuStat = $_.Group | where {$_.MetricId -eq "cpu.usage.average"} | Measure-Object -Property Value -Minimum -Maximum -Average
$row.MinCpu = "{0:f2}" -f ($cpuStat.Minimum)
$row.AvgCpu = "{0:f2}" -f ($cpuStat.Average)
$row.MaxCpu = "{0:f2}" -f ($cpuStat.Maximum)
$row.MemAlloc = $_.Group[0].Entity.MemoryMB
$memStat = $_.Group | where {$_.MetricId -eq "mem.usage.average"} | Measure-Object -Property Value -Minimum -Maximum -Average
$row.MinMem = "{0:f2}" -f ($memStat.Minimum)
$row.AvgMem = "{0:f2}" -f ($memStat.Average)
$row.MaxMem = "{0:f2}" -f ($memStat.Maximum)
$report += $row
}
$report | Export-Csv "C:\VM-stats1.csv" -NoTypeInformation -UseCulture