If you want to loop a number until it is greater than a certain number, you can use the do until command in Power Shell as follows:
> $a = 0 > do {$a} until ($a++ -gt 2)
The above command will produce the below outcome:
0 1 2 3
This is true because the program above will loop till that last number 3 which is greater than number 2 before stopping the loop!