Eintrag

check and beep

check and beep

check remote via ping and beep if not reachable

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# Define the target to ping
$target = "8.8.8.8"

# Function to emit a beep sound for 5 seconds
function Beep {
    [console]::beep(1000, 5000)
}

# Infinite loop to ping the target every 30 seconds
while ($true) {
    $pingResult = Test-Connection -ComputerName $target -Count 1 -Quiet
    if (-not $pingResult) {
        Write-Host "Target $target is not reachable." -ForegroundColor Red
        Beep
    } else {
        Write-Host "Target $target is reachable." -ForegroundColor Green
    }
    Start-Sleep -Seconds 30
}
Dieser Eintrag ist vom Autor unter CC BY 4.0 lizensiert.