Library / Networking

NETS-002 · Script

Network Reachability Checker

Tests whether a list of hosts resolve in DNS, answer ping and accept connections on a TCP port, and reports any that fail.

Version 1.0.0Language PowerShellUpdated November 2026Report only, changes nothing

What it does

For each target the script: 1. Resolves the name in DNS (skipped when you give an IP address). 2. Sends pings and measures packet loss and average round-trip time. 3. If a port is given, opens a TCP connection to it and measures the time. A target fails when DNS does not resolve, packet loss or average latency is above your thresholds, or the TCP port does not accept the connection. Results go to the log and to a CSV report. Nothing on the network or the machine is changed. No vendor API is used.

Many firewalls and servers block ping. For those, give a TCP port and set -PingCheck InfoOnly so ping results are recorded but do not cause a failure.

Requirements

Windows PowerShell 5.1 or PowerShell 7 (Windows, Linux or macOS). No extra modules.

How to run it

  • Run from: an admin workstation or scheduled task with the Microsoft modules installed and app sign-in configured
  • This is an admin script for your Networking tenant, not a per-device endpoint script
  • User interaction: none with app-only sign-in
  • Schedule: run on demand, or weekly for reports

Settings

NameWhat it doesOptionsDefault
TargetHosts to test. Each entry is host, host:port, name=host or name=host:port. Examples: 'core-switch=10.0.0.2', 'fw=10.0.0.1:443', 'dns1=8.8.8.8:53', 'intranet.school.local:443'. For IPv6 with a port use brackets: 'web=[2001:db8::10]:443'. To test several ports on one host, list it once per port.(none)
PingCountPings sent per target. Default: 4.4
MaxLossPercentHighest acceptable packet loss in percent. Default: 25 (one lost ping of four).25
MaxLatencyMsHighest acceptable average ping round-trip time in milliseconds. Default: 200.200
TimeoutMsTime to wait for each ping reply and for each TCP connection, in milliseconds. Default: 2000.2000
PingCheckRequired (default) = ping loss and latency count toward pass or fail. InfoOnly = ping is recorded but never causes a failure (use for hosts that block ICMP). Off = no ping is sent.Required, InfoOnly, OffRequired
ReportDirFolder for the CSV report. Leave empty for the default: C:\ProgramData\Runbookia\Reports on Windows, /var/lib/runbookia/reports elsewhere.

Exit codes

  • 0 = Every target passed
  • 1 = One or more targets failed a check
  • 2 = Script error (for example, no valid targets)

Testing steps

  1. Run it on one test tenant or small OU and check the output and log.
  2. Check the exit code: 0 = OK, 1 = needs attention, 2 = error (see log), 9 = this copy is past its Valid until date.
  3. Roll out to a small group next, then everyone.

Rollback steps

Report only. Nothing is changed, so nothing needs to be rolled back.

Version and change log

VersionDateChanges
1.0.0November 2026First release.