How to get Virtual Machine Maximum Memory using WMI?
On a Windows 2012 R2 virtual machine running under Hyper-V, Task Manager has the ability to display a virtual machine's maximum memory when the virtual machine is using dynamic memory, as shown in the screenshot below.
I've tried navigating through the following classes but I can't find what I need:
- Win32_OperatingSystem (TotalVisibleMemorySize only shows what the VM has consumed so far - not what the maximum is)
- Win32_PhysicalMemory
- Win32_PhysicalMemoryArray
- Win32_ComputerSystem (TotalPhysicalMemory only reports the same as TotalVisibleMemorySize above - i.e. the first of the Committed memory values)
Is it possible to programatically query using WMI or Registry to obtain this Maximum Memory value from inside the virtual machine itself?
memory virtual-machine hyper-v wmi
add a comment |
On a Windows 2012 R2 virtual machine running under Hyper-V, Task Manager has the ability to display a virtual machine's maximum memory when the virtual machine is using dynamic memory, as shown in the screenshot below.
I've tried navigating through the following classes but I can't find what I need:
- Win32_OperatingSystem (TotalVisibleMemorySize only shows what the VM has consumed so far - not what the maximum is)
- Win32_PhysicalMemory
- Win32_PhysicalMemoryArray
- Win32_ComputerSystem (TotalPhysicalMemory only reports the same as TotalVisibleMemorySize above - i.e. the first of the Committed memory values)
Is it possible to programatically query using WMI or Registry to obtain this Maximum Memory value from inside the virtual machine itself?
memory virtual-machine hyper-v wmi
add a comment |
On a Windows 2012 R2 virtual machine running under Hyper-V, Task Manager has the ability to display a virtual machine's maximum memory when the virtual machine is using dynamic memory, as shown in the screenshot below.
I've tried navigating through the following classes but I can't find what I need:
- Win32_OperatingSystem (TotalVisibleMemorySize only shows what the VM has consumed so far - not what the maximum is)
- Win32_PhysicalMemory
- Win32_PhysicalMemoryArray
- Win32_ComputerSystem (TotalPhysicalMemory only reports the same as TotalVisibleMemorySize above - i.e. the first of the Committed memory values)
Is it possible to programatically query using WMI or Registry to obtain this Maximum Memory value from inside the virtual machine itself?
memory virtual-machine hyper-v wmi
On a Windows 2012 R2 virtual machine running under Hyper-V, Task Manager has the ability to display a virtual machine's maximum memory when the virtual machine is using dynamic memory, as shown in the screenshot below.
I've tried navigating through the following classes but I can't find what I need:
- Win32_OperatingSystem (TotalVisibleMemorySize only shows what the VM has consumed so far - not what the maximum is)
- Win32_PhysicalMemory
- Win32_PhysicalMemoryArray
- Win32_ComputerSystem (TotalPhysicalMemory only reports the same as TotalVisibleMemorySize above - i.e. the first of the Committed memory values)
Is it possible to programatically query using WMI or Registry to obtain this Maximum Memory value from inside the virtual machine itself?
memory virtual-machine hyper-v wmi
memory virtual-machine hyper-v wmi
edited Sep 11 '15 at 7:17
asked Sep 10 '15 at 10:36
KeyszerS
21828
21828
add a comment |
add a comment |
2 Answers
2
active
oldest
votes
Modern operating systems (Windows 8/2012 and newer) includes a class named Win32_PerfRawData_Counters_HyperVDynamicMemoryIntegrationService under the namespace rootcimv2
This class has a property named MaximumMemoryMBytes which shows the maximum memory, also seen in Windows 2012 and above Task Managers.
VBScript Sample Code:
Set objWMIService = GetObject("winmgmts:\.rootcimv2")
Set colItems = objWMIService.ExecQuery("SELECT * FROM Win32_PerfRawData_Counters_HyperVDynamicMemoryIntegrationService",,48)
For Each Item in colItems
Wscript.Echo "Maximum memory in Megabytes " & Item.MaximumMemoryMbytes
Next
Powershell sample code:
Get-WmiObject -namespace rootcimv2 -class Win32_PerfRawData_Counters_HyperVDynamicMemoryIntegrationService | Select-Object MaximumMemoryMBytes
This class does not exist in Windows 2008 R2/Windows 7 or earlier operating systems.
More information about this class can be found here
add a comment |
I know I'm late, but I got troubled by this for a long time so...
Get-Counter "Hyper-v Dynamic Memory Integration ServiceMaximum Memory, Mbytes"
As far as I understand, the VM doesn't know if dynamic memory is enabled, it only knows how many memories have been allocated and the memory cap.
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "3"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f970989%2fhow-to-get-virtual-machine-maximum-memory-using-wmi%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
Modern operating systems (Windows 8/2012 and newer) includes a class named Win32_PerfRawData_Counters_HyperVDynamicMemoryIntegrationService under the namespace rootcimv2
This class has a property named MaximumMemoryMBytes which shows the maximum memory, also seen in Windows 2012 and above Task Managers.
VBScript Sample Code:
Set objWMIService = GetObject("winmgmts:\.rootcimv2")
Set colItems = objWMIService.ExecQuery("SELECT * FROM Win32_PerfRawData_Counters_HyperVDynamicMemoryIntegrationService",,48)
For Each Item in colItems
Wscript.Echo "Maximum memory in Megabytes " & Item.MaximumMemoryMbytes
Next
Powershell sample code:
Get-WmiObject -namespace rootcimv2 -class Win32_PerfRawData_Counters_HyperVDynamicMemoryIntegrationService | Select-Object MaximumMemoryMBytes
This class does not exist in Windows 2008 R2/Windows 7 or earlier operating systems.
More information about this class can be found here
add a comment |
Modern operating systems (Windows 8/2012 and newer) includes a class named Win32_PerfRawData_Counters_HyperVDynamicMemoryIntegrationService under the namespace rootcimv2
This class has a property named MaximumMemoryMBytes which shows the maximum memory, also seen in Windows 2012 and above Task Managers.
VBScript Sample Code:
Set objWMIService = GetObject("winmgmts:\.rootcimv2")
Set colItems = objWMIService.ExecQuery("SELECT * FROM Win32_PerfRawData_Counters_HyperVDynamicMemoryIntegrationService",,48)
For Each Item in colItems
Wscript.Echo "Maximum memory in Megabytes " & Item.MaximumMemoryMbytes
Next
Powershell sample code:
Get-WmiObject -namespace rootcimv2 -class Win32_PerfRawData_Counters_HyperVDynamicMemoryIntegrationService | Select-Object MaximumMemoryMBytes
This class does not exist in Windows 2008 R2/Windows 7 or earlier operating systems.
More information about this class can be found here
add a comment |
Modern operating systems (Windows 8/2012 and newer) includes a class named Win32_PerfRawData_Counters_HyperVDynamicMemoryIntegrationService under the namespace rootcimv2
This class has a property named MaximumMemoryMBytes which shows the maximum memory, also seen in Windows 2012 and above Task Managers.
VBScript Sample Code:
Set objWMIService = GetObject("winmgmts:\.rootcimv2")
Set colItems = objWMIService.ExecQuery("SELECT * FROM Win32_PerfRawData_Counters_HyperVDynamicMemoryIntegrationService",,48)
For Each Item in colItems
Wscript.Echo "Maximum memory in Megabytes " & Item.MaximumMemoryMbytes
Next
Powershell sample code:
Get-WmiObject -namespace rootcimv2 -class Win32_PerfRawData_Counters_HyperVDynamicMemoryIntegrationService | Select-Object MaximumMemoryMBytes
This class does not exist in Windows 2008 R2/Windows 7 or earlier operating systems.
More information about this class can be found here
Modern operating systems (Windows 8/2012 and newer) includes a class named Win32_PerfRawData_Counters_HyperVDynamicMemoryIntegrationService under the namespace rootcimv2
This class has a property named MaximumMemoryMBytes which shows the maximum memory, also seen in Windows 2012 and above Task Managers.
VBScript Sample Code:
Set objWMIService = GetObject("winmgmts:\.rootcimv2")
Set colItems = objWMIService.ExecQuery("SELECT * FROM Win32_PerfRawData_Counters_HyperVDynamicMemoryIntegrationService",,48)
For Each Item in colItems
Wscript.Echo "Maximum memory in Megabytes " & Item.MaximumMemoryMbytes
Next
Powershell sample code:
Get-WmiObject -namespace rootcimv2 -class Win32_PerfRawData_Counters_HyperVDynamicMemoryIntegrationService | Select-Object MaximumMemoryMBytes
This class does not exist in Windows 2008 R2/Windows 7 or earlier operating systems.
More information about this class can be found here
edited Sep 16 '15 at 12:15
answered Sep 16 '15 at 9:22
KeyszerS
21828
21828
add a comment |
add a comment |
I know I'm late, but I got troubled by this for a long time so...
Get-Counter "Hyper-v Dynamic Memory Integration ServiceMaximum Memory, Mbytes"
As far as I understand, the VM doesn't know if dynamic memory is enabled, it only knows how many memories have been allocated and the memory cap.
add a comment |
I know I'm late, but I got troubled by this for a long time so...
Get-Counter "Hyper-v Dynamic Memory Integration ServiceMaximum Memory, Mbytes"
As far as I understand, the VM doesn't know if dynamic memory is enabled, it only knows how many memories have been allocated and the memory cap.
add a comment |
I know I'm late, but I got troubled by this for a long time so...
Get-Counter "Hyper-v Dynamic Memory Integration ServiceMaximum Memory, Mbytes"
As far as I understand, the VM doesn't know if dynamic memory is enabled, it only knows how many memories have been allocated and the memory cap.
I know I'm late, but I got troubled by this for a long time so...
Get-Counter "Hyper-v Dynamic Memory Integration ServiceMaximum Memory, Mbytes"
As far as I understand, the VM doesn't know if dynamic memory is enabled, it only knows how many memories have been allocated and the memory cap.
answered Dec 19 '18 at 3:21
SilentTrack
1
1
add a comment |
add a comment |
Thanks for contributing an answer to Super User!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f970989%2fhow-to-get-virtual-machine-maximum-memory-using-wmi%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown