We can perform CPU stress test on a Windows machine without installing any external program. Here are the steps to perform CPU stress test in Windows using PowerShell Script.

Script to perform Stress Test on PowerShell

# Get the number of logical processors
$LogicalProcessorCount = (Get-WmiObject win32_processor | Select-Object -ExpandProperty NumberOfLogicalProcessors)

# Define the script block to run in each job
$stressTestScriptBlock = {
    $calculationResult = 1
    for ($outerLoop = 1; $outerLoop -le 2147483647; $outerLoop++) {
        $calculationResult = 1
        for ($middleLoop = 1; $middleLoop -le 2147483647; $middleLoop++) {
            $calculationResult = 1
            for ($innerLoop = 1; $innerLoop -le 2147483647; $innerLoop++) {
                $calculationResult = $calculationResult * $innerLoop
            }
        }
    }
}

# Start a job for each logical processor
for ($processorIndex = 1; $processorIndex -le $LogicalProcessorCount; $processorIndex++) {
    Start-Job -ScriptBlock $stressTestScriptBlock
}

# Wait for user input to exit
Read-Host "Press any key to exit..."

# Stop all jobs
Get-Job | Stop-Job