diff --git a/wakeup.ps1 b/wakeup.ps1 index b9425f1..6eea3b5 100644 --- a/wakeup.ps1 +++ b/wakeup.ps1 @@ -205,14 +205,14 @@ do } # sleep until next test interval and increase time counter - if ($targetComputers.Count -gt 0) + $connCheckTotalTime += $ConnectivityCheckInterval + if ($connCheckTotalTime -le $ConnectivityCheckTimeout -and $targetComputers.Count -gt 0) { for ($i = $ConnectivityCheckInterval; $i -gt 0; $i--) { Write-Progress -Activity "Waiting for next connectivity check..." -SecondsRemaining $i Start-Sleep 1 } Write-Progress -Activity "Waiting for next connectivity check..." -Completed - $connCheckTotalTime += $ConnectivityCheckInterval } } while ($connCheckTotalTime -le $ConnectivityCheckTimeout -and $targetComputers.Count -gt 0)