Quantcast
Channel: Category Name
Viewing all articles
Browse latest Browse all 1120

Getting VM Memory Usage and Demand Programmatically

$
0
0

A couple of people have recently asked me how to get virtual machine memory usage and memory demand programmatically.  What I am referring to is the information that we display here in Hyper-V Manager:

image

I have blogged about this in the past – but things have changed a bit since then – so I thought I would post an updated code sample.  Right here:


There are two main things to call out about this sample:

  • This information is all exposed on Msvm_SummaryInformation – which is documented here.
  • Memory demand is actually reported as a percentage of the used memory in the underlying API.  So to get the same information as is displayed by Hyper-V Manager – you have to do some math (included in the sample above)

Cheers,
Ben


Viewing all articles
Browse latest Browse all 1120

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>