Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

In ESXi, what is the automation/script (I expect it would be using PowerCLI somehow) approach to modify the number of VCPUs in a VM?

In context, when using our kickstarts, RHEL won't install the SMP kernel unless there is more than one CPU on the machine.

For most cases, there is no reason to want/need more than one VCPU on our VMs, but if we eventually need to use them, the OS has to be installed to a SMP machine, or the kernel doesn't take as full advantage of the available resources as it could.

What we would like to be able to do is the following for life-cycle management:

  • create VM with 2 VCPUs
  • install OS
  • remove VCPU

At a later date:

  • add VCPU(s) as needed

How should we do this?

share|improve this question
up vote 4 down vote accepted

You can use the PowerCLI command to set the number of CPUs on a VM:

Get-VM <VM Name> | Set-VM -numCPU 2
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.