A: Windows Server 2012 introduces the ability to track certain metrics for virtual machines (VMs):

  • Average CPU usage, measured in megahertz over a period of time
  • Average physical memory usage, measured in megabytes
  • Minimum memory usage (lowest amount of physical memory)
  • Maximum memory usage (highest amount of physical memory)
  • Maximum amount of disk space allocated to a virtual machine
  • Total incoming network traffic, measured in megabytes, for a virtual network adapter
  • Total outgoing network traffic, measured in megabytes, for a virtual network adapter

To start the gathering of metric data for a VM, you use the Enable-VMResourceMetering Windows PowerShell cmdlet:

Enable-VMResourceMetering -VMName <virtual machine name>

To reset the counters, use this command:

Reset-VMResourceMetering 

and to disable them, use

Disable-VMResourceMetering

To view the collected metrics, use this command:

Measure-VM cmdlet

Notice that in my example below, I pass the output object to the formal list (fl) alias to get full information you see below that (by default a table view is used which does not show all data). There is also a Measure-VMResourcePool cmdlet if resource pools are used.

  1. <br>
  2. PS C:\> <strong>measure-vm -Name savdaldc10 | fl<br></strong><br>
  3. ComputerName                   : SAVDALHV01<br>
  4. VMId                           : 89173c3f-6d85-434e-80a0-9dd631a21d0e<br>
  5. VMName                         : savdaldc10<br>
  6. MeteringDuration               : 00:01:33.9600000<br>
  7. AverageProcessorUsage          : 171<br>
  8. AverageMemoryUsage             : 2244<br>
  9. MaximumMemoryUsage             : 2244<br>
  10. MinimumMemoryUsage             : 2244<br>
  11. TotalDiskAllocation            : 40960<br>
  12. NetworkMeteredTrafficReport    : {Microsoft.HyperV.PowerShell.VMNetworkAdapterPortAclMeteringReport, <br>
  13.                                 Microsoft.HyperV.PowerShell.VMNetworkAdapterPortAclMeteringReport, <br>
  14.                                 Microsoft.HyperV.PowerShell.VMNetworkAdapterPortAclMeteringReport, <br>
  15.                                 Microsoft.HyperV.PowerShell.VMNetworkAdapterPortAclMeteringReport}<br>
  16. AvgCPU                         : 171<br>
  17. AvgRAM                         : 2244<br>
  18. MinRAM                         : 2244<br>
  19. MaxRAM                         : 2244<br>
  20. TotalDisk                      : 40960