Skip to content

Network

Franck SALLET edited this page Sep 5, 2026 · 1 revision

Network

Local network configuration, connectivity testing, routing, ARP, DNS, SSL, and diagnostics.

26 function(s) in Public/network/.

Functions

  • Clear-Arp — Clears the ARP (Address Resolution Protocol) cache on the local machine
  • Edit-HostsFile — Opens the Windows hosts file in an elevated editor
  • Export-NetworkConfig — Exports a complete network configuration snapshot to JSON or displays it as a summary
  • Get-ARPTable — Retrieves the ARP (Address Resolution Protocol) cache as structured objects
  • Get-ListeningPort — Shows which processes are listening on which ports
  • Get-NetworkAdapter — Retrieves consolidated network adapter information including IP, DNS, gateway, and speed
  • Get-NetworkCIDR — Retrieves CIDR notation for all IP addresses configured on network adapters
  • Get-NetworkConnection — Retrieves TCP and UDP network connections enriched with process info
  • Get-NetworkRoute — Retrieves IP routing table entries on one or more Windows computers
  • Get-NetworkStatistic — Retrieves network connection statistics grouped by process
  • Get-ProcessByPort — Correlate TCP/UDP endpoints with their owning process details
  • Get-PublicIPAddress — Retrieves the public IP address of the local or remote computer
  • Get-SSLCertificate — Retrieves SSL/TLS certificate information from remote endpoints
  • Get-SubnetInfo — Calculates subnet information from an IP address and subnet mask or CIDR notation
  • Measure-NetworkLatency — Measures network latency to one or more hosts with statistical summary
  • New-NetworkRoute — Creates a new static IP route on one or more Windows computers
  • Remove-NetworkRoute — Removes an IP route from the routing table on one or more Windows computers
  • Reset-NetworkStack — Reset the Windows network stack (winsock, TCP/IP, DNS cache, ARP)
  • Resolve-MACVendor — Resolves MAC addresses to their hardware vendor/manufacturer
  • Set-NetworkRoute — Modifies an existing IP route on one or more Windows computers
  • Show-NetworkStatisticMonitor — Interactive real-time monitor for TCP/UDP network connections
  • Show-PingMonitor — Interactive real-time ping monitor with ANSI-colored console display
  • Test-DNSResolution — Tests DNS name resolution across one or more DNS servers
  • Test-PortConnectivity — Tests TCP port connectivity on one or more remote hosts
  • Test-WinRM — Tests WinRM connectivity and configuration on remote computers
  • Trace-NetworkRoute — Performs a traceroute to a target host and returns structured hop-by-hop results

Reference

Clear-Arp

Clears the ARP (Address Resolution Protocol) cache on the local machine.

Removes all entries from the ARP cache by executing 'netsh interface ip delete arpcache'. This forces the system to re-resolve MAC addresses for all IP destinations, which can help resolve network connectivity issues caused by stale or incorrect ARP entries.

Requires administrator privileges to execute.

Syntax

Clear-Arp

Examples

Clear-Arp

Clears the entire ARP cache on the local machine.

Clear-Arp -WhatIf

Shows what would happen without actually clearing the ARP cache.

Clear-Arp -Verbose

Clears the ARP cache with verbose output showing execution details.


Edit-HostsFile

Opens the Windows hosts file in an elevated editor.

Launches the specified text editor (default: notepad.exe) as Administrator to edit the hosts file located at C:\Windows\System32\drivers\etc\hosts.

The editor process is started with the -Verb RunAs flag, which triggers a UAC elevation prompt if the current session is not already elevated.

Syntax

Edit-HostsFile [-Editor <string>]

Examples

Edit-HostsFile

Opens the hosts file in Notepad as Administrator.

Edit-HostsFile -Editor 'notepad++.exe'

Opens the hosts file in Notepad++ as Administrator.

Edit-HostsFile -Editor 'code'

Opens the hosts file in VS Code as Administrator.


Export-NetworkConfig

Exports a complete network configuration snapshot to JSON or displays it as a summary.

Collects all network configuration data from one or more computers into a single structured object: adapters, IP addresses, routes, DNS, ARP cache, listening ports, and firewall profile status.

The output can be piped to ConvertTo-Json for documentation, compared between machines, or used for audit/compliance purposes.

Syntax

Export-NetworkConfig [-ComputerName <string[]>] [-Credential <PSCredential>] [-Path <string>] [-ExcludeFirewall] [-ExcludeListeners] [-IncludeARP]

Examples

Export-NetworkConfig

Returns a complete network config object for the local machine.

Export-NetworkConfig -Path 'C:\docs\netconfig.json'

Exports local network config to a JSON file.

Export-NetworkConfig -ComputerName 'SRV01' -Credential (Get-Credential) | ConvertTo-Json -Depth 5

Exports remote server config as JSON.

'SRV01', 'SRV02' | Export-NetworkConfig -IncludeARP -ExcludeFirewall

Exports config including ARP cache but without firewall profiles from two servers.

Output: PSWinOps.NetworkConfig


Get-ARPTable

Retrieves the ARP (Address Resolution Protocol) cache as structured objects.

Parses the output of 'Get-NetNeighbor' cmdlet to return the local ARP cache as structured PowerShell objects. Each entry shows the IP address, MAC address, interface, and state of the ARP entry.

For remote computers, the query is executed via Invoke-Command.

Syntax

Get-ARPTable [-ComputerName <string[]>] [-Credential <PSCredential>] [-State <string>] [-AddressFamily <string>]

Examples

Get-ARPTable

Returns the local ARP cache (IPv4 entries).

Get-ARPTable -State Reachable

Returns only reachable ARP entries.

Get-ARPTable -ComputerName 'SRV01' -Credential (Get-Credential)

Returns the ARP cache from a remote server.

'SRV01', 'SRV02' | Get-ARPTable

Returns ARP tables from multiple servers via pipeline.

Output: PSWinOps.ArpEntry


Get-ListeningPort

Shows which processes are listening on which ports.

Retrieves TCP listening sockets and UDP bound endpoints, resolves the owning process name, and returns a consolidated view. Similar to 'netstat -tlnp' on Linux or the listening ports view in System Informer.

For remote computers, the query is executed via Invoke-Command.

Syntax

Get-ListeningPort [-ComputerName <string[]>] [-Credential <PSCredential>] [-Protocol <string[]>] [-Port <int>] [-ProcessName <string>]

Examples

Get-ListeningPort

Returns all listening TCP and bound UDP ports with process info.

Get-ListeningPort -Protocol TCP -Port 443

Shows which process is listening on TCP port 443.

Get-ListeningPort -ProcessName 'httpd*'

Shows all ports where Apache is listening.

'SRV01', 'SRV02' | Get-ListeningPort -Protocol TCP

Shows listening TCP ports on two remote servers.

Output: PSWinOps.ListeningPort


Get-NetworkAdapter

Retrieves consolidated network adapter information including IP, DNS, gateway, and speed.

Combines data from Get-NetAdapter, Get-NetIPAddress, Get-NetIPConfiguration, and Get-DnsClientServerAddress into a single structured view per adapter.

Replaces the need to run 4 separate cmdlets and manually correlate results.

Syntax

Get-NetworkAdapter [-ComputerName <string[]>] [-Credential <PSCredential>] [-IncludeDisabled] [-InterfaceName <string>]

Examples

Get-NetworkAdapter

Returns all active network adapters on the local machine.

Get-NetworkAdapter -IncludeDisabled

Returns all adapters including disabled ones.

Get-NetworkAdapter -ComputerName 'SRV01', 'SRV02' -Credential (Get-Credential)

Returns adapter info from two remote servers.

'SRV01', 'SRV02' | Get-NetworkAdapter -InterfaceName 'Ethernet*'

Pipeline: returns only Ethernet adapters from 2 servers.

Output: PSWinOps.NetworkAdapterInfo


Get-NetworkCIDR

Retrieves CIDR notation for all IP addresses configured on network adapters.

Enumerates all IPv4 and IPv6 addresses assigned to network interfaces and returns the corresponding CIDR notation (IP/PrefixLength), subnet mask, and network address. Combines data from Get-NetIPAddress and Get-NetAdapter for a consolidated view.

Syntax

Get-NetworkCIDR [-ComputerName <string[]>] [-Credential <PSCredential>] [-AddressFamily <string>] [-IncludeVirtual]

Examples

Get-NetworkCIDR

Returns all configured CIDRs on the local machine.

Get-NetworkCIDR -ComputerName 'SRV01' -AddressFamily IPv4

Returns only IPv4 CIDRs from remote server SRV01.

'SRV01', 'SRV02' | Get-NetworkCIDR -AddressFamily IPv4

Pipeline: returns IPv4 CIDRs from two remote servers.

Output: PSWinOps.NetworkCIDR

Returns one object per configured IP address with CIDR notation.


Get-NetworkConnection

Retrieves TCP and UDP network connections enriched with process info.

Returns one object per TCP or UDP connection on the target machine, including local and remote address/port, connection state, and the owning process name. Supports both local and remote queries via WinRM. Filtering is available on protocol, state, address, port, and process name.

For the local machine, cmdlets are called directly. For remote machines, the query is executed via Invoke-Command with WinRM.

Syntax

Get-NetworkConnection [-ComputerName <string[]>] [-Credential <PSCredential>] [-Protocol <string[]>] [-State <string[]>] [-LocalAddress <string>] [-LocalPort <int>] [-RemoteAddress <string>] [-RemotePort <int>] [-ProcessName <string>]

Examples

Get-NetworkConnection

Returns all TCP and UDP connections on the local machine.

Get-NetworkConnection -Protocol TCP -State Established

Returns only established TCP connections on the local machine.

Get-NetworkConnection -ComputerName 'SRV01', 'SRV02' -Protocol TCP -State Listen

Returns listening TCP connections on two remote servers.

Get-NetworkConnection -ProcessName 'svchost' -LocalPort 443

Returns connections on local port 443 owned by svchost.

'SRV01', 'SRV02' | Get-NetworkConnection -Credential (Get-Credential) -Protocol TCP

Queries multiple servers via pipeline with explicit credentials.

Output: PSWinOps.NetworkConnection

One object per connection with ComputerName, Protocol, LocalAddress, LocalPort, RemoteAddress, RemotePort, State, ProcessId, ProcessName, and Timestamp properties.


Get-NetworkRoute

Retrieves IP routing table entries on one or more Windows computers.

Queries the routing table using the Get-NetRoute cmdlet from the NetTCPIP module. Supports filtering by destination prefix, next hop gateway, interface alias, and address family (IPv4/IPv6).

For remote computers, the query is executed via Invoke-Command, which requires WinRM / WS-Man enabled on the target.

Syntax

Get-NetworkRoute [-ComputerName <string[]>] [-Credential <PSCredential>] [-DestinationPrefix <string>] [-NextHop <string>] [-InterfaceAlias <string>] [-AddressFamily <string>]

Examples

Get-NetworkRoute

Returns all routing table entries on the local machine.

Get-NetworkRoute -AddressFamily IPv4 -DestinationPrefix '0.0.0.0/0'

Returns the default IPv4 gateway route on the local machine.

Get-NetworkRoute -ComputerName 'SRV01' -Credential (Get-Credential)

Returns all routes on remote server SRV01.

'SRV01', 'SRV02' | Get-NetworkRoute -AddressFamily IPv4

Returns IPv4 routes for two servers via pipeline.

Output: PSWinOps.NetworkRoute

Route details including destination, next hop, interface, metric and address family.


Get-NetworkStatistic

Retrieves network connection statistics grouped by process.

Aggregates TCP and UDP connection data by process, providing a summary view of how many connections each process holds in each state. Internally calls Get-NetworkConnection to collect raw connection data, then groups and counts by process name and connection state.

This function is ideal for identifying which processes consume the most network connections or hold stale connections.

Syntax

Get-NetworkStatistic [-ComputerName <string[]>] [-Credential <PSCredential>] [-Protocol <string[]>] [-State <string[]>] [-ProcessName <string>]

Examples

Get-NetworkStatistic

Returns connection count summary grouped by process on the local machine.

Get-NetworkStatistic -ComputerName 'SRV01' -Protocol TCP

Returns TCP connection statistics grouped by process on SRV01.

'SRV01', 'SRV02' | Get-NetworkStatistic

Aggregates connection statistics by process across two remote servers.

Get-NetworkStatistic -ProcessName 'w3wp'

Shows connection breakdown for the IIS worker process only.

Output: PSWinOps.NetworkStatistic

Summary of network connections per process including counts by state.


Get-ProcessByPort

Correlate TCP/UDP endpoints with their owning process details.

Joins listening and established TCP/UDP endpoints with the details of their owning process (name, executable path, command line) in a single command. Correlates each endpoint's OwningProcess with Win32_Process via CIM and works against local or remote computers.

For remote computers, the query is executed via Invoke-Command.

Syntax

Get-ProcessByPort [-ComputerName <string[]>] [-Credential <PSCredential>] [-Port <int[]>] [-State <string>]

Examples

Get-ProcessByPort

Returns all TCP/UDP endpoints on the local machine with owning process details.

Get-ProcessByPort -Port 443 -State Listen

Shows which process is listening on TCP port 443 locally.

Get-ProcessByPort -ComputerName 'SRV01' -Credential $cred

Shows all endpoints and owning processes on a remote server.

'SRV01', 'SRV02' | Get-ProcessByPort -State Established

Shows established TCP connections and owning processes on two remote servers.

Output: PSWinOps.ProcessPort

One object per TCP/UDP endpoint, joined with owning process details.


Get-PublicIPAddress

Retrieves the public IP address of the local or remote computer.

Queries external HTTP APIs to determine the public-facing IPv4 and IPv6 addresses. Uses ipify.org as primary provider with ifconfig.me as fallback.

For remote computers, the query is executed via Invoke-Command so the result reflects each machine's own public IP.

Syntax

Get-PublicIPAddress [-ComputerName <string[]>] [-Credential <PSCredential>] [-TimeoutSec <int>] [-IPv6]

Examples

Get-PublicIPAddress

Returns the public IP of the local machine.

Get-PublicIPAddress -ComputerName 'SRV01' -Credential (Get-Credential)

Returns the public IP of remote server SRV01.

'SRV01', 'SRV02', 'SRV03' | Get-PublicIPAddress -IPv6

Returns IPv4 and IPv6 public addresses for three servers via pipeline.

Output: PSWinOps.PublicIPAddress

Returns an object per computer with IPv4Address, IPv6Address, Provider, and Timestamp.


Get-SSLCertificate

Retrieves SSL/TLS certificate information from remote endpoints.

Connects to one or more remote hosts using System.Net.Security.SslStream and retrieves the server certificate. Returns structured objects with subject, issuer, validity dates, days remaining, SAN entries, and thumbprint.

Ideal for proactive certificate expiry monitoring.

Syntax

Get-SSLCertificate -Uri <string[]> [-Port <int>] [-TimeoutMs <int>] [-AcceptUntrusted]

Examples

Get-SSLCertificate -Uri 'google.com'

Retrieves the SSL certificate from google.com:443.

Get-SSLCertificate -Uri 'mail.corp.local', 'intranet.corp.local' -Port 443

Checks certificates on two internal hosts.

Get-SSLCertificate -Uri 'myserver' -Port 8443

Checks a certificate on a non-standard HTTPS port.

Get-Content servers.txt | Get-SSLCertificate | Where-Object { $_.DaysRemaining -lt 30 }

Pipeline: find certificates expiring within 30 days.

Output: PSWinOps.SSLCertificate


Get-SubnetInfo

Calculates subnet information from an IP address and subnet mask or CIDR notation.

Computes detailed subnet properties including network address, broadcast address, first/last usable host, total host count, and wildcard mask.

Accepts input in CIDR notation (e.g., 192.168.1.0/24) or as separate IP and mask parameters.

This is a pure calculation function with no network access required.

Syntax

Get-SubnetInfo -IPAddress <string[]> [-PrefixLength <int>] [-SubnetMask <string>]

Examples

Get-SubnetInfo -IPAddress '192.168.1.0/24'

Calculates subnet info for a /24 network using CIDR notation.

Get-SubnetInfo -IPAddress '10.0.0.50' -PrefixLength 16

Calculates subnet info for a /16 network.

Get-SubnetInfo -IPAddress '172.16.0.0' -SubnetMask '255.255.240.0'

Uses traditional subnet mask notation.

'192.168.1.0/24', '10.0.0.0/8', '172.16.0.0/12' | Get-SubnetInfo

Calculates info for multiple subnets via pipeline.

Output: PSWinOps.SubnetInfo


Measure-NetworkLatency

Measures network latency to one or more hosts with statistical summary.

Sends ICMP echo requests (ping) to target hosts and computes statistics: minimum, maximum, average, jitter (standard deviation), and packet loss percentage.

Unlike Test-Connection, this function provides a statistical summary rather than individual ping results, making it ideal for network quality assessment.

Syntax

Measure-NetworkLatency -ComputerName <string[]> [-Count <int>] [-BufferSize <int>] [-DelayMs <int>]

Examples

Measure-NetworkLatency -ComputerName 'gateway.corp.local'

Sends 10 pings and returns latency statistics.

Measure-NetworkLatency -ComputerName '8.8.8.8', '1.1.1.1' -Count 50

Compares latency to Google DNS and Cloudflare with 50 pings each.

'SRV01', 'SRV02', 'SRV03' | Measure-NetworkLatency -Count 20

Pipeline: measures latency to 3 servers with 20 pings each.

Output: PSWinOps.NetworkLatency


New-NetworkRoute

Creates a new static IP route on one or more Windows computers.

Adds a static route to the routing table using the New-NetRoute cmdlet. Requires Administrator privileges.

For remote computers, the operation is executed via Invoke-Command, which requires WinRM / WS-Man enabled on the target.

Syntax

New-NetworkRoute [-ComputerName <string[]>] [-Credential <PSCredential>] -DestinationPrefix <string> -NextHop <string> [-InterfaceIndex <int>] [-InterfaceAlias <string>] [-RouteMetric <int>] [-AddressFamily <string>]

Examples

New-NetworkRoute -DestinationPrefix '10.10.0.0/16' -NextHop '192.168.1.1' -InterfaceAlias 'Ethernet'

Creates a static route to 10.10.0.0/16 via gateway 192.168.1.1 on the local machine.

New-NetworkRoute -DestinationPrefix '172.16.0.0/12' -NextHop '10.0.0.1' -InterfaceIndex 4 -RouteMetric 100

Creates a static route with a specific metric and interface index.

'SRV01', 'SRV02' | New-NetworkRoute -DestinationPrefix '10.10.0.0/16' -NextHop '192.168.1.1' -InterfaceAlias 'Ethernet'

Creates the same static route on two remote servers via pipeline.

Output: PSWinOps.NetworkRoute

The newly created route details.


Remove-NetworkRoute

Removes an IP route from the routing table on one or more Windows computers.

Deletes a route from the routing table using the Remove-NetRoute cmdlet. The route is identified by its destination prefix and optionally by interface and next hop.

Requires Administrator privileges.

For remote computers, the operation is executed via Invoke-Command, which requires WinRM / WS-Man enabled on the target.

Syntax

Remove-NetworkRoute [-ComputerName <string[]>] [-Credential <PSCredential>] -DestinationPrefix <string> [-InterfaceIndex <int>] [-InterfaceAlias <string>] [-NextHop <string>]

Examples

Remove-NetworkRoute -DestinationPrefix '10.10.0.0/16' -InterfaceAlias 'Ethernet'

Removes the route to 10.10.0.0/16 on the Ethernet interface.

Remove-NetworkRoute -DestinationPrefix '10.10.0.0/16' -InterfaceAlias 'Ethernet' -NextHop '192.168.1.1'

Removes a specific route identified by destination, interface and next hop.

'SRV01', 'SRV02' | Remove-NetworkRoute -DestinationPrefix '10.10.0.0/16' -InterfaceAlias 'Ethernet'

Removes the route on two remote servers via pipeline.


Reset-NetworkStack

Reset the Windows network stack (winsock, TCP/IP, DNS cache, ARP).

Encapsulates the classic netsh network-repair sequence (netsh winsock reset and netsh int ip reset) plus a DNS client cache flush and ARP cache clear into one idempotent, ShouldProcess-guarded action. Returns a structured result listing each step that ran with its exit code, overall success, and RebootRequired (always true). Requires administrator privileges and ALWAYS needs a reboot to finalize. WARNING: on a remote target netsh int ip reset can drop the WinRM session mid-run, so verify results out-of-band after running remotely.

Syntax

Reset-NetworkStack [-ComputerName <string[]>] [-Credential <System.Management.Automation.PSCredential>] [-IncludeFirewall] [-SkipDnsFlush]

Examples

Reset-NetworkStack
Local usage example.
Reset-NetworkStack -ComputerName SRV01 -IncludeFirewall
Remote single-machine example.
'SRV01', 'SRV02' | Reset-NetworkStack -SkipDnsFlush
Pipeline usage example.

Output: PSWinOps.NetworkStackResetResult

One object per target machine describing the steps that ran, their exit codes, overall Success, and RebootRequired (always $true).


Resolve-MACVendor

Resolves MAC addresses to their hardware vendor/manufacturer.

Looks up the manufacturer of a network device from its MAC address using the OUI (Organizationally Unique Identifier) prefix.

Includes a built-in database of the top 200+ most common vendors for fast offline lookup. Use -Online to query the macvendors.io API for unknown OUIs.

Syntax

Resolve-MACVendor -MACAddress <string[]> [-Online]

Examples

Resolve-MACVendor -MACAddress 'AA:BB:CC:DD:EE:FF'

Resolves a single MAC address.

Get-ARPTable | Resolve-MACVendor

Resolves all MAC addresses from the ARP table.

Resolve-MACVendor -MACAddress '00:50:56:C0:00:08', 'DC:A6:32:12:34:56' -Online

Resolves two MACs, querying the API for any not in the local database.

Output: PSWinOps.MACVendor


Set-NetworkRoute

Modifies an existing IP route on one or more Windows computers.

Updates properties of an existing route in the routing table using the Set-NetRoute cmdlet. Can modify the route metric of a route identified by its destination prefix and interface.

Requires Administrator privileges.

For remote computers, the operation is executed via Invoke-Command, which requires WinRM / WS-Man enabled on the target.

Syntax

Set-NetworkRoute [-ComputerName <string[]>] [-Credential <PSCredential>] -DestinationPrefix <string> [-InterfaceIndex <int>] [-InterfaceAlias <string>] [-NextHop <string>] -RouteMetric <int>

Examples

Set-NetworkRoute -DestinationPrefix '10.10.0.0/16' -InterfaceAlias 'Ethernet' -RouteMetric 50

Changes the metric of the route to 10.10.0.0/16 on the Ethernet interface to 50.

Set-NetworkRoute -DestinationPrefix '10.10.0.0/16' -InterfaceIndex 4 -RouteMetric 200

Changes the metric using interface index instead of alias.

'SRV01', 'SRV02' | Set-NetworkRoute -DestinationPrefix '10.10.0.0/16' -InterfaceAlias 'Ethernet' -RouteMetric 50

Modifies the route metric on two remote servers via pipeline.

Output: PSWinOps.NetworkRoute

The modified route details.


Show-NetworkStatisticMonitor

Interactive real-time monitor for TCP/UDP network connections.

Renders a full-screen terminal UI showing active network connections with ANSI-colored protocol and state indicators, sortable columns, and interactive keyboard controls. Internally calls Get-NetworkConnection at each refresh interval and builds the display frame via StringBuilder for flicker-free rendering. Press Q to quit, S to cycle sort column, R to reverse sort order, or P to pause/resume data collection.

Syntax

Show-NetworkStatisticMonitor [-ComputerName <string[]>] [-Credential <PSCredential>] [-Protocol <string[]>] [-State <string[]>] [-LocalAddress <string>] [-LocalPort <int>] [-RemoteAddress <string>] [-RemotePort <int>] [-ProcessName <string>] [-RefreshInterval <int>] [-NoClear] [-NoColor]

Examples

Show-NetworkStatisticMonitor

Starts real-time monitoring of all network connections on the local machine. Press Q to quit, S to cycle sort, R to reverse, P to pause.

Show-NetworkStatisticMonitor -Protocol TCP -State Established -RefreshInterval 5

Monitors only established TCP connections with a 5-second refresh interval.

'SRV01', 'SRV02' | Show-NetworkStatisticMonitor -Protocol TCP -NoColor

Monitors TCP connections on two remote servers without ANSI colors.


Show-PingMonitor

Interactive real-time ping monitor with ANSI-colored console display.

Continuously pings one or more hosts and displays live statistics in an interactive console interface with ANSI color-coded status indicators. Supports keyboard controls for sorting, pausing, clearing statistics, and quitting. Press Q to quit, S to cycle sort, C to clear stats, P to pause/resume monitoring.

Syntax

Show-PingMonitor -ComputerName <string[]> [-RefreshInterval <int>] [-PingTimeoutMs <int>] [-NoClear] [-NoColor]

Examples

Show-PingMonitor -ComputerName '192.168.1.1', 'google.com'

Monitors two hosts with default settings. Press Q to quit, S to sort, C to clear statistics, P to pause or resume monitoring.

Show-PingMonitor -ComputerName 'SRV01' -RefreshInterval 5 -NoColor

Monitors a single server with 5-second refresh and ANSI colors disabled.

'SRV01', 'SRV02', 'SRV03' | Show-PingMonitor -PingTimeoutMs 1000

Monitors three servers via pipeline input with a 1-second ping timeout.


Test-DNSResolution

Tests DNS name resolution across one or more DNS servers.

Resolves a hostname against multiple DNS servers and compares the results. Useful for diagnosing DNS propagation issues, split-horizon DNS, or identifying inconsistent resolution between internal and external DNS.

Uses Resolve-DnsName cmdlet under the hood.

Syntax

Test-DNSResolution -Name <string[]> [-DnsServer <string[]>] [-Type <string>]

Examples

Test-DNSResolution 'srv-app01.corp.local'

Resolves the name using the system default DNS server (positional).

Test-DNSResolution -Name 'google.com' -DnsServer '8.8.8.8', '1.1.1.1'

Compares resolution of google.com across Google DNS and Cloudflare.

Test-DNSResolution -Name 'srv01.corp.local' -DnsServer '10.0.0.1', '10.0.0.2', '8.8.8.8'

Checks if internal name resolves consistently across internal and external DNS.

'srv01', 'srv02', 'srv03' | Test-DNSResolution -DnsServer '10.0.0.1'

Resolves multiple names via pipeline against a specific DNS server.

Output: PSWinOps.DnsResolution


Test-PortConnectivity

Tests TCP port connectivity on one or more remote hosts.

Uses System.Net.Sockets.TcpClient to test whether specified TCP ports are reachable on target computers. Much faster than Test-NetConnection for bulk testing because it uses a configurable timeout and tests multiple port/host combinations sequentially.

Returns structured objects suitable for pipeline processing and reporting.

Syntax

Test-PortConnectivity -ComputerName <string[]> -Port <int[]> [-TimeoutMs <int>]

Examples

Test-PortConnectivity -ComputerName 'SRV01' -Port 443

Tests if port 443 is open on SRV01.

Test-PortConnectivity -ComputerName 'SRV01', 'SRV02' -Port 80, 443, 3389

Tests 3 ports on 2 servers (6 tests total).

'WEB01', 'WEB02', 'WEB03' | Test-PortConnectivity -Port 443, 8080

Pipeline input: tests 2 ports on 3 servers.

Test-PortConnectivity -ComputerName '10.0.0.1' -Port 1..1024 -TimeoutMs 500

Scans ports 1-1024 on a host with a 500ms timeout.

Output: PSWinOps.PortConnectivity


Test-WinRM

Tests WinRM connectivity and configuration on remote computers.

Performs a comprehensive WinRM connectivity test on both HTTP (5985) and HTTPS (5986) by default:

  1. Tests TCP port reachability
  2. Tests WSMan connection via Test-WSMan
  3. Tests actual command execution via Invoke-Command

Returns two rows per computer (HTTP + HTTPS), giving a complete picture in a single call. Use -Protocol to test only one protocol.

Syntax

Test-WinRM [-ComputerName <string[]>] [-Credential <PSCredential>] [-Protocol <string[]>] [-TimeoutMs <int>]

Examples

Test-WinRM

Tests WinRM on the local computer over both HTTP (5985) and HTTPS (5986).

Test-WinRM -ComputerName 'SRV01'

Tests WinRM on SRV01 over both HTTP (5985) and HTTPS (5986).

Test-WinRM -ComputerName 'SRV01' -Protocol HTTP

Tests WinRM on SRV01 over HTTP only.

Test-WinRM -ComputerName 'SRV01' -Credential (Get-Credential)

Full test with credentials (both protocols).

'SRV01', 'SRV02', 'SRV03' | Test-WinRM

Pipeline: tests WinRM on 3 servers (both protocols each).

Output: PSWinOps.WinRMTestResult


Trace-NetworkRoute

Performs a traceroute to a target host and returns structured hop-by-hop results.

Sends ICMP packets with incrementing TTL values to trace the network path to a destination. Each hop is returned as a structured object with hop number, IP address, hostname (via reverse DNS), and round-trip latency.

Uses System.Net.NetworkInformation.Ping with controlled TTL values, which is more reliable and parseable than the native tracert.exe.

Syntax

Trace-NetworkRoute -ComputerName <string[]> [-MaxHops <int>] [-TimeoutMs <int>] [-PingsPerHop <int>] [-SkipNameResolution]

Examples

Trace-NetworkRoute -ComputerName '8.8.8.8'

Traces the route to Google DNS.

Trace-NetworkRoute -ComputerName 'srv01.corp.local' -MaxHops 15

Traces route to an internal server with max 15 hops.

'8.8.8.8', '1.1.1.1' | Trace-NetworkRoute -SkipNameResolution

Traces routes to two targets without reverse DNS (faster).

Output: PSWinOps.TraceRouteHop


PSWinOps Wiki

Home

Domains

Clone this wiki locally