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
Like this
Get-VM | Select Name,CpuHotAddEnabled
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Like this
Get-VM | Select Name,CpuHotAddEnabled
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
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,
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