Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
$vm = Get-VM -Name "lab-advent-01"
@(1400, 0),
@(1400, 3),
@(1800, 8),
@(1500, 5),
@(2900, 3),
@(2850, 3),
@(2800, 3),
@(2750, 3),
@(2700, 3),
@(2650, 3),
@(2600, 3),
@(2550, 3),
@(2500, 3),
@(2450, 3),
@(2400, 3),
@(2350, 3),
@(2300, 3),
@(2250, 3),
@(2200, 3),
@(2150, 3),
@(2100, 3),
@(2050, 3),
@(2000, 3),
@(1950, 3),
@(1900, 3),
@(1850, 3),
@(1800, 3),
@(1750, 3),
@(1700, 3),
@(1650, 3),
@(1600, 3),
@(1550, 3),
@(1500, 3),
@(1450, 3),
@(1400, 3) | ForEach-Object {
$cpu_mhz = $_[0]
$wait = 20 * $_[1] #seconds
$vm_res_config = Get-VMResourceConfiguration -VM $vm | Set-VMResourceConfiguration -CpuLimitMhz $cpu_mhz
Write-Host ("CPU Limit Mhz: " + $vm_res_config.CpuLimitMhz + " : " + (Get-Date))
Start-Sleep $wait
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment