VMWare vSphere – CLI Fun

In an attempt to figure out how to limit a collection of VMs to only 500MHz in CPU resources, we found that this can be done with a simple CLI Script:

After opening the Power CLI and connecting it to the vCenter Server that hosts the VMs, run the following command, substituting appropriate strings for the %placeholders%

Get-VM -Name %ComputerName% | Get-VMResourceConfiguration | Set-VMResourceConfiguration -CpuLimitMhz %MHz%

You can run this for all machines by simply using an asterisk for the computer name. Otherwise, you can use a wildcard in place of portions of the computer name (E.G. Test*, Workstation10*)



Leave a Reply