VMware Cloud Community
esxi1979
Expert
Expert
Jump to solution

CpuHotAddEnabled : New-VIProperty

Hi,

Can someone help me how to use this new-propterty .. ?

New-VIProperty -Name 'CpuHotAddEnabled' `

  -BasedOnExtensionProperty 'Config.ExtraConfig' `

  -ObjectType VirtualMachine `

  -Value {

    param($vm)

    [bool]( $vm.ExtensionData.Config.ExtraConfig | `

      ? { $_.key -eq 'vcpu.hotadd' }).Value

  } -warningAction 'silentlycontinue' -Force

i tried get-vm abcd |CpuHotAddEnabled, no luck


thanks





1 Solution

Accepted Solutions
LucD
Leadership
Leadership
Jump to solution

Like this

Get-VM | Select Name,CpuHotAddEnabled


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

View solution in original post

3 Replies
LucD
Leadership
Leadership
Jump to solution

Like this

Get-VM | Select Name,CpuHotAddEnabled


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

esxi1979
Expert
Expert
Jump to solution

Thanks LucD, Ok got it, so it will just let me know if enabled/disabled ..

I got a fuction which can enable it ..

Function Enable-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="true"

    $vmConfigSpec.extraconfig += $extra

    $vmview.ReconfigVM($vmConfigSpec)

}

Any better way than this ?

Thanks,

0 Kudos
LucD
Leadership
Leadership
Jump to solution

No, since there is no cmdlet for this, you'll have to do it trough an API method.


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference