Retrieve Hyper-V VM’s usage using PowerShell.

Hi All,

This week my customer wanted to retrieve all virtual machines usages including memory allocations, also dynamic memory, CPU usage, network, disk size allocation, and any relevant data that can represent machines resources and performance comprehensively.

After a deep dive on the internet, I found that we have to enable “VMResourceMetering” on all nodes in order to get more depth details.

So, in order to enable it per a node you have to run the following command:

Enable-VMResourceMetering -ComputerName “NodeName:-VMName *

– It will run on each machine and enable the VMResourceMetering option.

Then, you will be able to make use in “Measure-VM” command, like this one:

Get-ClusterGroup | ? {$_.GroupType -eq ‘VirtualMachine’ } | Get-VM | Measure-VM

it goes over on all machines (no matter how many nodes you have) and represents All Virtual machines usages like:

Average CPU usage [MHz]

MAX &  MIN physical memory usage

Total incoming and outgoing network traffic

and more good information,

You can enable this per one  VM and get an information, see below the command per one VM

Enable-VMResourceMetering -Vmware

Then run this to get the info you expected to:

get-vm <Name> | Mesaure-vm