VMware Cloud Community
dtracey
Expert
Expert
Jump to solution

Host System Resource Allocation / Reservation via PowerCLI

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

Tags (3)
0 Kudos
1 Solution

Accepted Solutions
LucD
Leadership
Leadership
Jump to solution

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

View solution in original post

0 Kudos
1 Reply
LucD
Leadership
Leadership
Jump to solution

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

0 Kudos