Created
September 2, 2024 18:29
-
-
Save Computer-Tsu/66bb06c4ca3b0b9ae38042044766c1e7 to your computer and use it in GitHub Desktop.
Monitor server or IP with audible bell when offline
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $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