I need to programatically determine how much memory a Hyper-V guest with dynamic memory is using, from within the guest running Windows Server 2008 R2, without access to the host.
The total amount the guest thinks it is using is, of course, easy to get. But most of that is driver locked memory created by the memory balloon, not memory actually in use by the guest. I have not been able to find a way to query the current size of the memory balloon.
You can see the size of the driver locked memory using Sysinternals RAMMap.exe, but I need a way to get that value in PowerShell.
Any ideas?