Skip to content

Instantly share code, notes, and snippets.

@gowatana
Last active November 30, 2020 15:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gowatana/ee236bc1fc3fd4561ddc06beb7289d1a to your computer and use it in GitHub Desktop.
Save gowatana/ee236bc1fc3fd4561ddc06beb7289d1a to your computer and use it in GitHub Desktop.
$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