Summary: Use Windows PowerShell 3.0 and Windows Server 2012 to collect virtual machine performance information.

Hey, Scripting Guy! Question How do I collect performance data on a daily basis for a specific Hyper-V virtual machine?

Hey, Scripting Guy! Answer Charlotte Windows PowerShell User group member Brian Wilhite says: There are two cmdlets that we’ll use first, enable monitoring, or metering as the cmdlet states, and then the actual data collection cmdlet after metering is enabled. To enable monitoring of the virtual machine, you’ll need to use Enable-VMResourceMetering, and then you’ll need to capture the data by running Measure-VM.

Enable-VMResourceMetering -VMName VSVR01

Measure-VM -VMName VSVR01

You can also pipe this to Export-Csv by using the Append parameter to collect the data for trending purposes.

Measure-VM -VMName VSVR01 | Export-Csv -Path C:\PerfData\VSVR01.csv –Append

Finally, you can set up a scheduled task to run the above two lines on a daily basis.