Skip to content

Instantly share code, notes, and snippets.

@trnktms
Last active May 28, 2021 14:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save trnktms/90457b9ab5dea7ea1fb4d198875581d0 to your computer and use it in GitHub Desktop.
Save trnktms/90457b9ab5dea7ea1fb4d198875581d0 to your computer and use it in GitHub Desktop.
while ($true) {
$measuredTime = (Measure-Command -Expression { Invoke-WebRequest -Uri www.google.com }).TotalMilliseconds;
If ($measuredTime -gt 1000) {
$color = "red"
}
Else {
$color = "green"
}
Write-Host (Get-Date -Format "HH:mm:ss.ffff"): $measuredTime -ForegroundColor $color
}
@trnktms
Copy link
Author

trnktms commented May 28, 2021

Here is the one-liner for PS console:

while ($true) { $measuredTime = (Measure-Command -Expression { Invoke-WebRequest -Uri www.google.com }).TotalMilliseconds; If ($measuredTime -gt 1000) { $color = "red" } Else { $color = "green" } Write-Host (Get-Date -Format "HH:mm:ss.ffff"): $measuredTime -ForegroundColor $color }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment