*How to stress the CPU 100% with powershell
*stress your CPU with powershell
*max CPU load with powershell
*read-host
*write-warning
*start-job
*write-output
*foreach()
In this video I demonstrate how you can stress your CPU to the max with powershell. :-)
Code :
[cmdletbinding()]
param(
[parameter(mandatory=$true)][int]$NumHyperCores
)
Write-Output "============= CPU Stress Test Started: $(get-date) ============="
Write-Warning "This script will potentially max your CPU utilization!"
$Prompt = Read-Host "Are you sure you want to proceed? (Y/N)"
if ($Prompt -eq 'Y') {
Write-Warning "To cancel execution of all jobs, close the PowerShell Host Window."
Write-Output "Hyper Core Count: $NumHyperCores"
Measure-Command {
foreach ($loopnumber in 1..$NumHyperCores){
Start-Job -ScriptBlock{
$result = 1
foreach ($number in 1..214748369){
$result = $result * $number
}
}
}
Wait-Job *
Clear-Host
Receive-Job *
Remove-Job *
}
}
else{
Write-Output "Cancelled!"
}
Смотрите видео PowerShell S2E7 (CPU Stress) онлайн, длительностью часов минут секунд в хорошем качестве, которое загружено на канал Mr Automation 20 Август 2020. Делитесь ссылкой на видео в социальных сетях, чтобы ваши подписчики и друзья так же посмотрели это видео. Данный видеоклип посмотрели 953 раз и оно понравилось 8 посетителям.