Quantcast
Channel: Rob V IT
Viewing all articles
Browse latest Browse all 64

Generate CPU Load with PowerShell

$
0
0

In some situations you need to stress your system a little (for example: to check if your monitoring is functioning properly.)

Installing some random .exe files from some anonymous websites is not always a good idea. So hereby a little script for blowing your CPU to 100%.

The script creates a nice calculation for all of your “Windows Logical Processors”

$NumberOfLogicalProcessors = Get-WmiObject win32_processor | Select-Object -ExpandProperty NumberOfLogicalProcessors

ForEach ($core in 1..$NumberOfLogicalProcessors){ 

start-job -ScriptBlock{

    $result = 1;
    foreach ($loopnumber in 1..2147483647){
        $result=1;
        
        foreach ($loopnumber1 in 1..2147483647){
        $result=1;
            
            foreach($number in 1..2147483647){
                $result = $result * $number
            }
        }

            $result
        }
    }
}

Read-Host "Press any key to exit..."
Stop-Job *

The post Generate CPU Load with PowerShell appeared first on Rob V IT.


Viewing all articles
Browse latest Browse all 64

Trending Articles