PowerShell replaces legacy text-based networking tools (such as ipconfig, netstat, route, and ping) with structured, object-oriented cmdlets. Most networking functionality comes from the built-in NetTCPIP, NetAdapter, and NetConnection modules, which ship with Windows and expose commands following the standard Verb-Noun convention. Rather than parsing fragile text output, these cmdlets emit strongly-typed .NET and CIM objects that can be piped directly into Where-Object, Sort-Object, Select-Object, or Export-Csv.
Legacy Tools vs. Modern PowerShell Cmdlets
Traditional command-line utilities emit unformatted text strings that require string parsing (using findstr or regular expressions). PowerShell cmdlets output structured objects, allowing direct filtering, sorting, and automation.
| Legacy Utility | PowerShell Cmdlet | Module | Primary Purpose |
|---|---|---|---|
ipconfig |
Get-NetIPAddress, Get-NetIPConfiguration |
NetTCPIP / NetAdapter |
View IP addresses and interface settings |
netstat |
Get-NetTCPConnection, Get-NetUDPEndpoint |
NetTCPIP |
Inspect active sockets and listening ports |
route |
Get-NetRoute, New-NetRoute, Remove-NetRoute |
NetTCPIP |
Query and manipulate IP routing tables |
ping |
Test-Connection |
Microsoft.PowerShell.Management |
Send ICMP echo requests |
arp -a |
Get-NetNeighbor |
NetTCPIP |
View IP-to-physical address mappings |
nslookup |
Resolve-DnsName |
DnsClient |
Perform DNS record lookups |
Get-Command -Module NetTCPIP, NetAdapter | Select-Object NameName
----
Get-NetIPAddress
Get-NetIPConfiguration
Get-NetRoute
Get-NetTCPConnection
Get-NetAdapter
Enable-NetAdapter
Disable-NetAdapter
Restart-NetAdapter
...Categories of Networking Cmdlets
| Category | Example Cmdlets | Purpose |
|---|---|---|
| Connectivity testing | Test-Connection, Test-NetConnection |
Ping hosts, test port availability |
| IP configuration | Get-NetIPConfiguration, Get-NetIPAddress |
View/set IP settings |
| Adapter management | Get-NetAdapter, Enable-NetAdapter, Disable-NetAdapter |
Manage network interfaces |
| Connections & statistics | Get-NetTCPConnection, Get-NetAdapterStatistics |
Inspect active connections and traffic |
| File sharing | New-SmbMapping, Get-SmbMapping |
Map and manage network drives |
| Computer identity | Get-ComputerInfo, Rename-Computer |
View/manage machine network identity |
Introduction to the NetTCPIP Module
The NetTCPIP module is built into Windows and provides end-to-end control of the TCP/IP network protocol stack, including configuring IP addresses, managing routing tables, querying TCP connections, and fine-tuning network interfaces directly through the pipeline. It is a binary module (backed by compiled code, not a .psm1 file), which is why its cmdlets appear instantly available without an explicit Import-Module: Windows loads it via module auto-loading.
Its cmdlets are divided into specific operational functional groups:
- IP Addresses (
*-NetIPAddress): Query, assign, and remove IPv4 and IPv6 addresses. - IP Interfaces (
*-NetIPInterface): Configure MTU size, DHCP client behavior, IPv6 router discovery, and interface metrics. - Routing Table (
*-NetRoute): Create static routes, view the default gateway, and manage next-hop metrics. - Neighbor Discovery (
*-NetNeighbor): Manage the ARP and IPv6 neighbor cache. - Transport Connections (
*-NetTCPConnection): Query active TCP sockets, process owners, and state transitions.
Get-Command -Module NetTCPIP -Verb Get |
Select-Object -Property Name, CommandType -First 6where:
Get-Commandqueries registered cmdlets and functions matching criteria.-Module NetTCPIPscopes command search exclusively to theNetTCPIPmodule.-Verb Getfilters only retrieval cmdlets.Select-Object -First 6restricts display output to the first six matches.
./discover-nettcpip.ps1Name CommandType
---- -----------
Get-NetCompartment Function
Get-NetIPAddress Function
Get-NetIPConfiguration Function
Get-NetIPInterface Function
Get-NetIPv4Protocol Function
Get-NetIPv6Protocol FunctionViewing IP Configuration
The Get-NetIPConfiguration cmdlet is the object-based equivalent of ipconfig, returning structured configuration details per network adapter.
Get-NetIPConfigurationInterfaceAlias : Ethernet
InterfaceIndex : 12
InterfaceDescription : Intel(R) Ethernet Connection
IPv4Address : 192.168.1.42
IPv4DefaultGateway : 192.168.1.1
DNSServer : 192.168.1.1Viewing IP Addresses Directly
For a flatter list of assigned IP addresses across all adapters, use Get-NetIPAddress.
Get-NetIPAddress -AddressFamily IPv4where -AddressFamily filters results to IPv4 or IPv6 addresses only.
IPAddress : 192.168.1.33
InterfaceIndex : 6
InterfaceAlias : Ethernet0
AddressFamily : IPv4
Type : Unicast
PrefixLength : 24
PrefixOrigin : Dhcp
SuffixOrigin : Dhcp
AddressState : Preferred
ValidLifetime : 9.19:38:05
PreferredLifetime : 9.19:38:05
SkipAsSource : False
PolicyStore : ActiveStore
IPAddress : 127.0.0.1
InterfaceIndex : 1
InterfaceAlias : Loopback Pseudo-Interface 1
AddressFamily : IPv4
Type : Unicast
PrefixLength : 8
PrefixOrigin : WellKnown
SuffixOrigin : WellKnown
AddressState : Preferred
ValidLifetime : Infinite ([TimeSpan]::MaxValue)
PreferredLifetime : Infinite ([TimeSpan]::MaxValue)
SkipAsSource : False
PolicyStore : ActiveStoreFiltering by Adapter Alias
Get-NetIPAddress -AddressFamily IPv4 -InterfaceAlias "Ethernet*", "Wi-Fi*" |
Select-Object -Property InterfaceAlias, IPAddress, PrefixLength, AddressStatewhere:
Get-NetIPAddressqueries configured IP addresses from the network stack.-AddressFamily IPv4restricts results to IPv4 addresses (excluding IPv6 link-local and global addresses).-InterfaceAliasfilters results by adapter name using wildcard matching.Select-Objectchooses specific properties for tabular formatting.
./get-ip-summary.ps1InterfaceAlias IPAddress PrefixLength AddressState
-------------- --------- ------------ ------------
Ethernet0 192.168.1.33 24 PreferredInspecting Interface Metrics and Gateways
Network performance and routing priority are determined by interface metrics. Lower metric values indicate higher route priority. The following script identifies all active interfaces, their configured IP addresses, and their associated route metric.
Get-NetIPInterface -AddressFamily IPv4 -ConnectionState Connected |
Select-Object -Property InterfaceAlias, InterfaceIndex, InterfaceMetric, Dhcp |
Sort-Object -Property InterfaceMetricwhere:
Get-NetIPInterfaceretrieves configuration settings for TCP/IP interface endpoints.-AddressFamily IPv4limits the evaluation to IPv4 stacks.-ConnectionState Connectedtargets only physically or logically connected adapters.InterfaceMetricis the numerical cost assigned to the interface; lower values indicate preferred traffic routing.Dhcpindicates whether IP parameters are assigned dynamically (Enabled) or statically (Disabled).Sort-Object -Property InterfaceMetricsorts the interfaces by route preference.
./audit-interfaces.ps1InterfaceAlias InterfaceIndex InterfaceMetric Dhcp
-------------- -------------- --------------- ----
Ethernet0 8 15 Enabled
Wi-Fi 4 25 Enabled
Loopback Pseudo-Interface 1 1 75 DisabledPlatform Availability: Windows PowerShell vs. PowerShell 7 on Linux/macOS
The NetTCPIP module is an operating system-specific module provided by Microsoft for Windows.
- On Windows: available out-of-the-box on both Windows PowerShell 5.1 and modern PowerShell 7+.
- On Linux and macOS: the
NetTCPIPmodule is unavailable because non-Windows operating systems lack the underlying Windows CIM provider infrastructure (Root/StandardCimv2).
Practical Usage: Quick Network Health Snapshot
A common first step in troubleshooting is gathering a snapshot of adapter status, IP configuration, and connectivity in one script.
Write-Output "=== Network Adapters ==="
Get-NetAdapter |
Select-Object Name, Status, LinkSpeed |
Format-Table -AutoSize
Write-Output "`n=== IP Configuration ==="
$config = Get-NetIPConfiguration
foreach ($adapter in $config) {
Write-Output "Interface: $($adapter.InterfaceAlias)"
if ($adapter.IPv4Address) {
Write-Output "IPv4 Address: $($adapter.IPv4Address.IPAddress)"
}
else {
Write-Output "IPv4 Address: None"
}
if ($adapter.IPv4DefaultGateway) {
Write-Output "Default Gateway: $($adapter.IPv4DefaultGateway.NextHop)"
}
else {
Write-Output "Default Gateway: None"
}
Write-Output ""
}
Write-Output "=== Connectivity Test ==="
Test-Connection -ComputerName "8.8.8.8" -Count 2 -Quietwhere:
Get-NetAdapterlists physical/virtual network interfaces and their link status.Get-NetIPConfigurationsummarizes IP settings per adapter.Test-Connection -Quietreturns a simple$true/$falseresult for connectivity.
./network-snapshot.ps1=== Network Adapters ===
Name Status LinkSpeed
---- ------ ---------
Bluetooth Network Connection Disconnected 3 Mbps
Ethernet0 Up 1 Gbps
=== IP Configuration ===
Interface: Ethernet0
IPv4 Address: 192.168.178.33
Default Gateway: 192.168.178.1
Interface: Bluetooth Network Connection
IPv4 Address: 169.254.19.170
Default Gateway: None
=== Connectivity Test ===
True