In part 1 of this post we discussed planning for vCPU resource assignment for Server 2012 R2 Hyper-V VMs. Now let’s take a look at ways in which you can perform the assignment of vCPUs to your virtual machines.
The Hyper-V Manger application can be launched in Server 2012 via the Server Manager > Tools menu. Via Hyper-V Manager, you need to locate the virtual machine you would like to reconfigure and right-click to open the Settings menu. You will see the processor icon as circled in this screenshot. Adjust the number of vCPUs accordingly, then close the Settings menu and restart your virtual machine.
Alternatively, you could run the below sequence of PowerShell commands to shut down your VM, change the number of assigned vCPUs, then restart your VM:
To arrive at the appropriate number of vCPUs to assign to a particular virtual machine, you’ll need to consider and research the recommended or required number of CPUs as specified by the application(s) you will be running on the VM. Knowing this information before deploying your VM will help you locate the appropriate host as well as in arriving at the number of vCPUs to assign. Typically, more is better when applying resources, but with our ever-tightening IT budgets, sometimes frugality is required in laying out our environments. Along this same line of thought, I highly recommend reserving your Hyper-V server(s) solely for hosting your virtual environment. Adding other non-host related functions to this server shrinks your available resource pool for your virtual machines and complicates your recovery scenarios in the event of corruption, data loss or disaster.