To calculate the amount of data transmitted and received over the last day for a specific VM, you could do
$vmName = 'MyVM'
$stat = 'net.bytesRX.average','net.bytesTx.average'
$finish = Get-Date
$start = $finish.AddDays(-1)
$vm = Get-VM -Name $vmName
Get-Stat -Instance '' -Entity $vm -Stat $stat -Start $start |
Group-Object -Property MetricId | %{
if($_.Name -match 'bytesrx'){
$receivedKB = ($_.Group | Measure-Object -Property Value -Sum |
select -ExpandProperty Sum) * $_.Group[0].IntervalSecs
}
if($_.Name -match 'bytestx'){
$transmitKB = ($_.Group | Measure-Object -Property Value -Sum |
select -ExpandProperty Sum) * $_.Group[0].IntervalSecs
}
}
[ordered]@{
VM = $vmName
Start = $start
Finish = $finish
ReceivedKB = $receivedKB
TransmitKB = $transmitKB
}