How to get Virtual Machine Maximum Memory using WMI?












1














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.



enter image description here



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?










share|improve this question





























    1














    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.



    enter image description here



    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?










    share|improve this question



























      1












      1








      1







      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.



      enter image description here



      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?










      share|improve this question















      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.



      enter image description here



      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






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Sep 11 '15 at 7:17

























      asked Sep 10 '15 at 10:36









      KeyszerS

      21828




      21828






















          2 Answers
          2






          active

          oldest

          votes


















          0














          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






          share|improve this answer































            0














            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.






            share|improve this answer





















              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
              });


              }
              });














              draft saved

              draft discarded


















              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









              0














              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






              share|improve this answer




























                0














                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






                share|improve this answer


























                  0












                  0








                  0






                  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






                  share|improve this answer














                  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







                  share|improve this answer














                  share|improve this answer



                  share|improve this answer








                  edited Sep 16 '15 at 12:15

























                  answered Sep 16 '15 at 9:22









                  KeyszerS

                  21828




                  21828

























                      0














                      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.






                      share|improve this answer


























                        0














                        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.






                        share|improve this answer
























                          0












                          0








                          0






                          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.






                          share|improve this answer












                          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.







                          share|improve this answer












                          share|improve this answer



                          share|improve this answer










                          answered Dec 19 '18 at 3:21









                          SilentTrack

                          1




                          1






























                              draft saved

                              draft discarded




















































                              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.




                              draft saved


                              draft discarded














                              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





















































                              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







                              Popular posts from this blog

                              How do I know what Microsoft account the skydrive app is syncing to?

                              Grease: Live!

                              When does type information flow backwards in C++?