Infinite Delayed Loops

Execute code block then delay 3 seconds:

This works because Do..Until┬ákeeps looping until the expression between ( and ) evaluate to $true. Since Start-Sleep doesn’t return any value it will never equal $true thus creating the infinite loop.


Delay 3 seconds then execute code block:

This works because -not turns the empty response from Start-Sleep into a $true. Since this will never change we get our infinite loop. This is the same as the Do..Until example above except Start-Sleep is executed before the code block instead of after.