Hello again chaps,
Does anyone know if there is a way to set the reserved CPU and memory for a host via PowerCLI?
(Host > Configuration > System Resource Allocation > Edit)
I usually set the memory reservation to 800MB and the CPU to 800MHz as per design best practices.
Thanks,
Dan
Afaik, there is no cmdlet for that, but you can use the UpdateSystemResources method.
You just need to know that the key for those entries is "host/system".
$esx = Get-VMHost MyHost
$spec = New-Object VMware.Vim.HostSystemResourceInfo
$spec.key = "host/system"
$spec.Config = New-Object VMware.Vim.ResourceConfigSpec
$spec.Config.cpuAllocation = New-Object VMware.Vim.ResourceAllocationInfo
$spec.Config.cpuAllocation.reservation = 800
$spec.Config.memoryAllocation = New-Object VMware.Vim.ResourceAllocationInfo
$spec.Config.memoryAllocation.reservation = 800
$spec.Config.ChangeVersion = $esx.ExtensionData.SystemResources.Config.ChangeVersion
$esx.ExtensionData.UpdateSystemResources($spec)
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Afaik, there is no cmdlet for that, but you can use the UpdateSystemResources method.
You just need to know that the key for those entries is "host/system".
$esx = Get-VMHost MyHost
$spec = New-Object VMware.Vim.HostSystemResourceInfo
$spec.key = "host/system"
$spec.Config = New-Object VMware.Vim.ResourceConfigSpec
$spec.Config.cpuAllocation = New-Object VMware.Vim.ResourceAllocationInfo
$spec.Config.cpuAllocation.reservation = 800
$spec.Config.memoryAllocation = New-Object VMware.Vim.ResourceAllocationInfo
$spec.Config.memoryAllocation.reservation = 800
$spec.Config.ChangeVersion = $esx.ExtensionData.SystemResources.Config.ChangeVersion
$esx.ExtensionData.UpdateSystemResources($spec)
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference