I had a need to enable CPU and Memory hotadd to many virtual machines prior to a template being updated, doing some research there is no easy way, however there are some functions out there to do it. You can copy and paste each function into a powershell window and then run the associated command.
1Enable-MemHotAdd $ServerName2Disable-MemHotAdd $ServerName3Enable-vCPUHotAdd $ServerName4Disable-vCPUHotAdd $ServerNameEnable Memory HotAdd
1Function Enable-MemHotAdd($vm){2$vmview = Get-vm $vm | Get-View3$vmConfigSpec = New-Object VMware.Vim.VirtualMachineConfigSpec4$extra = New-Object VMware.Vim.optionvalue5$extra.Key="mem.hotadd"6$extra.Value="true"7$vmConfigSpec.extraconfig += $extra8$vmview.ReconfigVM($vmConfigSpec)9}Disable Memory HotAdd
1Function Disable-MemHotAdd($vm){2$vmview = Get-VM $vm | Get-View3$vmConfigSpec = New-Object VMware.Vim.VirtualMachineConfigSpec4$extra = New-Object VMware.Vim.optionvalue5$extra.Key="mem.hotadd"6$extra.Value="false"7$vmConfigSpec.extraconfig += $extra8$vmview.ReconfigVM($vmConfigSpec)9}Enable CPU HotAdd
1Function Enable-vCpuHotAdd($vm){2$vmview = Get-vm $vm | Get-View3$vmConfigSpec = New-Object VMware.Vim.VirtualMachineConfigSpec4$extra = New-Object VMware.Vim.optionvalue5$extra.Key="vcpu.hotadd"6$extra.Value="true"7$vmConfigSpec.extraconfig += $extra8$vmview.ReconfigVM($vmConfigSpec)9}Disable CPU HotAdd
1Function Disable-vCpuHotAdd($vm){2$vmview = Get-vm $vm | Get-View3$vmConfigSpec = New-Object VMware.Vim.VirtualMachineConfigSpec4$extra = New-Object VMware.Vim.optionvalue5$extra.Key="vcpu.hotadd"6$extra.Value="false"7$vmConfigSpec.extraconfig += $extra8$vmview.ReconfigVM($vmConfigSpec)9}