Search code examples
powershellhyper-v

How to Get Hard Drive Memory and CPU Usage of a VM Using Powershell


Is it possible to get the hard drive memory and CPU usage of a virtual machine without going inside the VM itself? If I use Get-VM | fl * to get all the available properties, I do not find any that resemble the HD memory or the CPU usage.

Thanks in advance for the help!


Solution

  • Have a look at Measure-VM and its 'requirement' Enable-VMResourceMetering

    So essentially to enable it for all VMs you can execute

    Get-VM | Enable-VMResourceMetering  
    

    and then to get actual resource metrics for the VMs you can execute

    Get-VM | Measure-VM  
    

    Of course you can also disable it again with Disable-VMResourceMetering