diff --git a/wakeup.ps1 b/wakeup.ps1 index ef1adb7..df5b2a9 100644 --- a/wakeup.ps1 +++ b/wakeup.ps1 @@ -161,11 +161,11 @@ for ($i = $ConnectivityCheckDelay; $i -gt 0; $i--) { Write-Progress -Activity "Waiting for computer(s) to wake-up..." -Completed # iterate computers and test connectivity -# TODO: run multiple connectivity tests as needed, spaced evenly apart up to max timeout THEN fail +# TODO: report error/fail only after final run # TODO: run connectivity test as background job $connCheckTotalTime = 0 $removeFromTargetComputers.Clear() -while ($connCheckTotalTime -le $ConnectivityCheckTimeout -and $targetComputers.Count -gt 0) +do { $targetComputers | ForEach-Object { $name = $_.name @@ -213,7 +213,7 @@ while ($connCheckTotalTime -le $ConnectivityCheckTimeout -and $targetComputers.C Write-Progress -Activity "Waiting for next connectivity check..." -Completed $connCheckTotalTime += $ConnectivityCheckInterval } -} +} while ($connCheckTotalTime -le $ConnectivityCheckTimeout -and $targetComputers.Count -gt 0) # exit gracefully exitGracefully \ No newline at end of file