PowerTip: Use PowerShell to Find Virtual Machines Using Dynamic Memory

PowerTip: Use PowerShell to Find Virtual Machines Using Dynamic Memory

  • Comments 3
  • Likes

Summary: Use Windows PowerShell to find which virtual machines on Hyper-V is using dynamic memory.

Hey, Scripting Guy! Question How can I tell which of my virtual machines are running with dynamic memory ?

Hey, Scripting Guy! Answer Use the Get-VMMemory cmdlet:

GET-VMMemory -vmname "My Virtual Machine"

(Check the results for "DynamicMemoryEnabled" as "True.")

To check all virtual machines, the dynamic memory status, and the allocated RAM on the Hyper-V host, use:

GET-VM | GET-VMmemory

Your comment has been posted.   Close
Thank you, your comment requires moderation so it may take a while to appear.   Close
Leave a Comment
  • Had to run Powershell as an Administrator.

  • <DISCLAIMER>Did not test<DISCLAIMER>

    this is what i would do instead of having to work for PoSh:

    $vm_name=read-host -prompt “VM name”

    if ($(GET-VMMemory -vmname $vm_name | select DynamicMemoryEnabled) -eq $TRUE){

            write “`n$vm_name is running with dynamic memory`n”

       }

    elseif ($(GET-VMMemory -vmname $vm_name | select DynamicMemoryEnabled) -eq $FALSE){

            write “`n$vm_name is running with static memory`n”

            }

    else{

            write “`n`t`tERROR`n”

    }

  • Thanks