VMware

Disabling memory and cpu hot plug from cli on 6.7?

I have been trying to implement a way to batch add/remove the hot add featured from my environment and I’ve followed this page’s method:

​

[https://ict-freak.nl/2009/10/05/powercli-enabledisable-the-vm-hot-add-features/](https://ict-freak.nl/2009/10/05/powercli-enabledisable-the-vm-hot-add-features/)

​

It basically involves creating a function:

​

`Function Disable-MemHotAdd($vm){`

`$vmview = Get-vm $vm | Get-View`

`$vmConfigSpec = New-Object VMware.Vim.VirtualMachineConfigSpec`

`$extra = New-Object VMware.Vim.optionvalue`

`$extra.Key=”mem.hotadd”`

`$extra.Value=”false”`

`$vmConfigSpec.extraconfig += $extra`

`$vmview.ReconfigVM($vmConfigSpec)`

`}`

​

….and calling it.

​

However, this does not work with vcenter 6.7: The vmx does not get altered and ther machine does not change its setting, even after reboot, or even runningf the comand while the vm is powered off.

​

Does anyone know of the correct way to modify these parameters on tthe latest vcenter versions? That method I linked seems to be only working on 5.x versions.

​

Thanks!



View Reddit by R3DNanoView Source

 

To see the full content, share this page by clicking one of the buttons below

Related Articles

One Comment

  1. Function Disable-MemHotAdd($vmName){

    $VM = Get-VM $vmName

    $spec = New-Object VMware.Vim.VirtualMachineConfigSpec

    $spec.memoryHotAddEnabled = $false

    $VM.ExtensionData.ReconfigVM_Task($spec)

    }

    Function Disable-vCpuHotAdd($vmName){

    $VM = Get-VM $vmName

    $spec = New-Object VMware.Vim.VirtualMachineConfigSpec

    $spec.cpuHotAddEnabled = $false

    $VM.ExtensionData.ReconfigVM_Task($spec)

    }

Leave a Reply