I am trying to determine the best way to display the Memory and vCPU Hot Add/Plug settings in the PowerCLI console. I am currently using this code to display these settings but I am not sure if the output is correct or if I can adjust it any way to improve it:
Get-Datacenter|Get-VM|Get-View|Select $($row.Name),
@{N="CpuHotAddEnabled";E={$_.Config.CpuHotAddEnabled}},@{N="MemoryHotAddEnabled";E={$_.Config.MemoryHotAddEnabled}} |
write-host-foregroundcolorgreen
Write-Host""
The output from this code is:
@{VM1=; CpuHotAddEnabled=True; MemoryHotAddEnabled=True}
@{VM1=; CpuHotAddEnabled=True; MemoryHotAddEnabled=True}
@{VM1=; CpuHotAddEnabled=False; MemoryHotAddEnabled=False}
@{VM1=; CpuHotAddEnabled=False; MemoryHotAddEnabled=False}
I have verified that both Memory and vCPU Hot Add/Plug settings are enabled and the output is somewhat confusing me - it correctly indicates that both are enabled but then proceeds to show that their enabled status is 'False' in the proceeding lines. I am wondering if there is any adjustment possible to improve this to only show the true status of these settings.
Thank you for any help you may provide,