You can modify the CPU levels of a virtual machine using a combination of the Get-View and Get-VIObjectByVIView cmdlets.

Verify that you are connected to a vCenter Server system.

1

Get the VM2 virtual machine, shut it down, and pass it to the Get-View cmdlet to view the virtual machine view object.

$vmView = Get-VM VM2 | Stop-VM | Get-View
2

Create a VirtualMachineConfigSpec object to modify the virtual machine CPU levels and call the ReconfigVM method of the virtual machine view managed object.

$spec = New-Object VMware.Vim.VirtualMachineConfigSpec;
$spec.CPUAllocation = New-Object VMware.Vim.ResourceAllocationInfo;
$spec.CpuAllocation.Shares = New-Object VMware.Vim.SharesInfo;
$spec.CpuAllocation.Shares.Level = "normal";
$spec.CpuAllocation.Limit = -1;
$vmView .ReconfigVM_Task($spec)
3

Get the virtual machine object by using the Get-VIObjectByVIView cmdlet and start the virtual machine.

$vm =  Get-VIObjectByVIView $vmView  | Start-VM