Quantcast
Channel: VMware Communities : All Content - All Communities
Viewing all articles
Browse latest Browse all 175326

remove memory reservation

$
0
0

Hi

 

PowerCLI C:\> Get-VM  xxx | Get-VMResourceConfiguration | Select-Object Name,  CpuReservationMhz, MemReservationMB

 

 

Name CpuReservationMhz MemReservationMB

---- ----------------- ----------------

                     0             8192

 

 

i was able to remove cpu reservation with below

 

foreach ($line in $csv)
{

Get-VM $($line.name) |% {Get-View $_.ID} | % {

  $spec = new-object VMware.Vim.VirtualMachineConfigSpec;

  $spec.CPUAllocation = $_.ResourceConfig.CpuAllocation

  $spec.CpuAllocation.Reservation = 0;

  $_.ReconfigVM_Task($spec)

}

 

 

}

 

 

 

but it does not work for memory

 

for me even below did not work

 

 

1

 

 

Get-VM|Get-VMResourceConfiguration|where{$_.MemLimitMB-ne'-1'}|Set-VMResourceConfiguration-MemLimitMB$null

 

 

 

 

below did not work too

 

$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)

}

 

 

 

i tried below too

 

$spec = New-Object VMware.Vim.VirtualMachineConfigSpec

$spec.memoryReservationLockedToMax = $true

(Get-VM xxx).ExtensionData.ReconfigVM_Task($spec)

 

no luck

 

Please  help


Viewing all articles
Browse latest Browse all 175326

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>