Skip to content

Instantly share code, notes, and snippets.

@s-h-a-d-o-w
Last active January 9, 2026 14:18
Show Gist options
  • Select an option

  • Save s-h-a-d-o-w/934c6ef2e05f3f3ba74f4f6c0b1bf94f to your computer and use it in GitHub Desktop.

Select an option

Save s-h-a-d-o-w/934c6ef2e05f3f3ba74f4f6c0b1bf94f to your computer and use it in GitHub Desktop.
Repeatedly checks whether a certain IP is reachable and shows a popup if it's not.
$ip = "192.168.1.1"
Add-Type -AssemblyName System.Windows.Forms
while ($true) {
if (!(Test-Connection $ip -Count 1 -Quiet)) {
[System.Windows.Forms.MessageBox]::Show(
"Device $ip is offline!",
"Network Alert",
[System.Windows.Forms.MessageBoxButtons]::OK,
[System.Windows.Forms.MessageBoxIcon]::Warning
) | Out-Null
}
Start-Sleep -Seconds 5
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment