Retry-Command


Retry-Command
    [-ScriptBlock] <ScriptBlock>
    [-Maximum] <int> = 5
    [-Delay] <int> = 100

Description

The Retry-Command function is a helper to run the contents of the script block a number of times if there is an error with a delay between.

By default, it will retry 5 times, with a delay of 100ms.

Example


Retry-Command -ScriptBlock { Write-Host "Test" } -Maximum 5 -Delay 500