Powercli script to get VM’s disk Latency.

If you want to quickly check the virtual machine’s Average and Max latency , here is the script for this :

Get-VM -Name VmName | ? {$_.PowerState -eq "PoweredOn"} | Select Name, @{n="AVG Max Latency (ms)";e={(get-stat -Entity $_ -Stat Disk.MaxTotalLatency.Latest -Start (Get-Date).AddDays(-1) | Measure Value -Average ).Average }},@{n="Max Latency (ms)";e={(get-stat -Entity $_ -Stat Disk.MaxTotalLatency.Latest -Start (Get-Date).AddDays(-7) | Measure Value -Maximum ).Maximum }}

Output :

Name                                      AVG Max Latency (ms)           Max Latency (ms)

Virtual Machine                      0.579136690647482                            5

Leave a Reply

Your email address will not be published. Required fields are marked *