So, here is the PowerShell script (one line) that will max out your CPU:
while ($true) {$n++;$n=0}I'm not sure that the $n=0 is required, but I'm concerned that it will go past the limit of the integer variable type if it runs for an extended period of time.
Also note that this maxes out only a single CPU core because PowerShell is a single process running on a single core. In our virtual machines for courses, this is fine because each virtual machine has only a single virtual CPU.
If you need to max out multiple CPU cores then you probably need to open multiple instances of PowerShell and run the script in each one.