network_scan.ps1 - limehawk/rmm-scripts GitHub Wiki
network_scan.ps1
Scans a range of IP addresses using multi-threaded ping requests to discover active hosts on the network.
Overview
This script uses multi-threaded ping requests to scan a range of IP addresses and discover active hosts on the network. It can optionally resolve hostnames via DNS for discovered devices.
Purpose
Scans a range of IP addresses using multi-threaded ping requests to discover active hosts on the network. Optionally resolves hostnames via DNS.
Prerequisites
- Windows PowerShell 5.1 or later
- Network access to target IP range
Configuration
Required Inputs
$startIP: Starting IP address of the range to scan$endIP: Ending IP address of the range to scan$disableDNS: Skip DNS hostname resolution (faster)$threads: Number of concurrent threads (default: 32)$pingAttempts: Number of ping attempts per IP (default: 1)
Behavior
- Validates IP address range
- Creates runspace pool for parallel execution
- Pings each IP in the range
- Optionally resolves hostnames for responding IPs
- Outputs results sorted by IP address
Security Notes
- No secrets in logs
- Only performs ICMP ping and DNS lookups
Exit Codes
- 0 = Success
- 1 = Failure (invalid IP range)
Example Output
[ INPUT VALIDATION ]
--------------------------------------------------------------
Start IP : 192.168.1.1
End IP : 192.168.1.254
Threads : 32
[ SCANNING NETWORK ]
--------------------------------------------------------------
Scanning 254 IP addresses...
[ RESULTS ]
--------------------------------------------------------------
IPv4Address Status Hostname
----------- ------ --------
192.168.1.1 Up router.local
192.168.1.10 Up desktop-pc.local
192.168.1.25 Up
[ FINAL STATUS ]
--------------------------------------------------------------
Result : 3 hosts found
[ SCRIPT COMPLETED ]
--------------------------------------------------------------
Version History
- 2024-12-01 v1.0.0 - Initial release - migrated from SuperOps
Links
- View Script Source
- Scripts - Back to script index