Get-VMMetering script to collect and reset VM Metering data, report to CSV

This script can be downloaded from the Microsoft Script Center Repository. It can be set as a scheduled task on one of the Hyper-V hosts in the environment, not all of them.

Set the schedule of the scheduled task to run as often as you’d like to have the VM metering data collected and reset.

Edit the top 3 lines to match your environment details:

  • $CSV = “d:\sandbox\MeteringReports”
    • Edit this line to enter the path to the folder to save CSV files. This can be a UNC path like “\\server\share\folder”
  • $HVHosts = @(“Host1″,”Host2”)
    • Edit this line to list Hyper-V hosts in your environment
  • $Sort = “AvgCPU”
    • Edit this line to change the report sort order. Options include: AvgCPU, AvgRAM, MaxRAM, MinRAM, TotalDisk, NetworkInbound, NetworkOutbound, VMName, ComputerName

Report data and output will look like:



One response

  1. Haji

    Hi, I was wondering How could I use this script to get the total Traffic used by the VMs?! Thank you

    February 21, 2018 at 12:51 pm

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.