Description
Retrieves the local system routing table and returns key route details, including destination prefix, next hop, interface index, metric, and protocol, as structured PowerShell objects.
Overview
Get-SystemRouteTable retrieves the local system’s IP routing table using the built-in Get-NetRoute cmdlet and outputs a simplified set of route objects to the PowerShell pipeline.
This is useful for quickly inspecting network routing configuration, identifying default routes, and reviewing interface- and metric-related path selection data.
What it does
- Verifies that the
Get-NetRoutecmdlet is available on the system - Queries the system routing table
- Returns route entries with the following properties:
DestinationPrefixNextHopInterfaceIndexRouteMetricProtocol
Requirements
- Windows system with the
Get-NetRoutecmdlet available - Appropriate permissions to query network configuration
Output
The script outputs one or more PowerShell objects representing route entries.
Output Properties
| Property | Description |
|---|---|
DestinationPrefix |
The destination network prefix for the route |
NextHop |
The next-hop address used for the route |
InterfaceIndex |
The interface index associated with the route |
RouteMetric |
The route metric used to influence path selection |
Protocol |
The source or protocol associated with the route |
Error Handling
If Get-NetRoute is not available, the script throws the following error:
Get-NetRoute cmdlet not available on this system.
