Skip to content

Instantly share code, notes, and snippets.

@Computer-Tsu
Created September 2, 2024 18:29
Show Gist options
  • Save Computer-Tsu/66bb06c4ca3b0b9ae38042044766c1e7 to your computer and use it in GitHub Desktop.
Save Computer-Tsu/66bb06c4ca3b0b9ae38042044766c1e7 to your computer and use it in GitHub Desktop.
Monitor server or IP with audible bell when offline
$Server = Read-Host "Enter server name to monitor by sonar"
$x = 0
Write-Host "Pinging $Server by sonar . . . "
Write-Host "(Press Ctrl-C to break out of sonar loop.)"
do
{ $x = $x + 1
if (Test-Connection -count 1 -quiet -computer $Server)
{
[console]::beep(500,600)
Start-Sleep -s 2
}
else
{
[console]::beep(500,60)
$x = $x + 1
}
}
until
($x = 0)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment