The basic structure is to use the Get-Stat cmdlet and use the Group-Object to split up the results.
Something like this
$start= (Get-Date).AddDays(-2)$counters="disk.commandsAborted.summation","disk.totalLatency.average","disk.queueLatency.average"
$entity=Get-VMHost-NameMyEsx
Get-Stat-Entity$entity-Stat$counters-Start$start|Group-Object-PropertyTimestamp|%{ New-ObjectPSObject-Property@{ Name=$_.Group[0].Entity.Name
Time=$_.Group[0].Timestamp
CommandsAborted=$_.Group|where {$_.MetricId-eq"disk.commandsAborted.summation"} |Select-ExpandPropertyValue
TotalLatency=$_.Group|where {$_.MetricId-eq"disk.totalLatency.average"} |Select-ExpandPropertyValue
QueueLatency=$_.Group|where {$_.MetricId-eq"disk.queueLatency.average"} |Select-ExpandPropertyValue
} }
You can of course do this for multiple ESXi servers or take an average over the complete timespan.