1 Reply Latest reply on Mar 5, 2015 8:32 AM by Zsoldier

    Removing "Reserve all guest memory (All Locked)"

    jessem Enthusiast

      Hello,

       

      I am trying to remove a checkbox for memory setting - "Reserve all guest memory (All Locked)" on some VMs in a cluster.  I am trying to run a powercli command on a "per-cluster" basis.

       

      Any help is appreciated.

        • 1. Re: Removing "Reserve all guest memory (All Locked)"
          Zsoldier Expert
          vExpert

          Seems to be a new thing in 5.5.  Never noticed it before, but was a fun exercise for me.  This is written to change ALL VM's.  There is no checking to see whether the box is checked or what the reservation is set at.  With that said, below will probably get you on the right path.

           

          $VMs = Get-Cluster | Get-VM

           

          Foreach ($VM in $VMs)

          {

          $configspec = New-Object VMware.Vim.VirtualMachineConfigSpec

          $configspec.MemoryAllocation = New-Object VMware.Vim.ResourceAllocationInfo

          # This will uncheck the box.

          $configspec.MemoryReservationLockedToMax = $false

          # This will put the reservation back to 0

          $configspec.MemoryAllocation[0].Reservation = 0

          $VM.ExtensionData.ReconfigVM($ConfigSpec)

          }