How to run a command in PowerShell on startup?


I’m new here. I just want to know how could I run a command in PowerShell automatically every time I turn on my PC. The command is this one:

“$i=99999900; while (1) { $j=[System.Math]::Sqrt($i); write-host $i,:,$j; $i=($i+1)%99999999; }”

It is just a counter to keep my CPU busy for preventig BSODs due to a faulty processor. Anyone knows how can I achieve this?

Thanks in advance!

I realize your question isn’t really related to PoshTools but…

You can always run a PS script via task Scheduler on Start up:

You could also create a registry entry under


powershell.exe -command “$i=99999900; while (1) { $j=[System.Math]::Sqrt($i); write-host $i,:,$j; $i=($i+1)%99999999; }”