Hello
I am trying to work out how can I enable "Memory hot add" via powershell to a Vcloud environment VM.
I am trying to look at the following extensiondata but I just can't work it out.
$vm = Get-CIVM -Name $server1
$vm.ExtensionData. ????????
I have found code that is for vshere but not vcloud.
Any help ?
Have a look at Enable VM Hot-Add CPU/Memory on reboot
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Hello,
I had to change the script cause we are on VCloud
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)
$vm.Extensiondata.ReconfigureVm_task($vmConfigSpec)
}
Connect-CIServer -Server $vcd02 -org $orgArp -Credential $IAASRH
Get-Content "c:\temp\listofvms.txt" | %{
$vm = Get-CIVM -Name $_
Enable-vCpuAndMemHotAdd $vm
}
When I run it I get the following error
Enable-vCpuAndMemHotAdd($vm)
Cannot find an overload for "ReconfigureVm_Task" and the argument count: "1".
At line:22 char:3
+ $vm.Extensiondata.ReconfigureVm_task($vmConfigSpec)
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [], MethodException
+ FullyQualifiedErrorId : MethodCountCouldNotFindBest
You will need the VirtualMachine object.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference