Hi All,
Does anyone know of a way to automatically enable Hot-Add when a machine is rebooted? I have been trying to use this script that I found at https://communities.vmware.com/thread/287941:
Function Enable-vCpuAndMemHotAdd($vm){
$vmConfigSpec = New-Object VMware.Vim.VirtualMachineConfigSpec
$extra1 = New-Object VMware.Vim.optionvalue
$extra1.Key="mem.hotadd"
$extra1.Value="true"
$vmConfigSpec.extraconfig += $extra1
$extra2 = New-Object VMware.Vim.optionvalue
$extra2.Key="vcpu.hotadd"
$extra2.Value="true"
$vmConfigSpec.extraconfig += $extra2
$vm.Extensiondata.ReconfigVM($vmConfigSpec)
}
Get-Content "c:\listofvms.txt" | %{
$vm = Get-VM -Name $_
Enable-vCpuAndMemHotAdd $vm
}
It works great when the VMs are powered off, but does not make the change if they are running. Does anyone know of a way to modify this script so that the new setting will take effect the next time the VM is rebooted?
Thanks