PowerShell Windows networking
The NetTCPIP and NetAdapter modules replaced the old command-line tools with cmdlets that return objects. Get-NetAdapter lists interfaces, Get-NetIPAddress lists addresses, Get-NetIPConfiguration gives you the summary that ipconfig used to, and Get-NetRoute shows the routing table.
Documentation: Microsoft Learn
Overview
Test-NetConnection is the one that changes how you troubleshoot. Test-NetConnection host -Port 443 tells you whether a specific port is reachable, which ping cannot do. In PowerShell 7, Test-Connection -TargetName host -TcpPort 443 is the cross-platform equivalent. Most connectivity problems are one port on one host, not a dead machine, so port-level testing is what you want.
The advantage over the old tools is that you can filter. Get-NetAdapter | Where-Object Status -eq 'Up' is a query; parsing ipconfig output with regex is a chore that breaks when the locale changes.
These modules are Windows-only. On Linux and macOS, PowerShell 7 gives you Test-Connection and the platform's own tools, not Get-NetAdapter.
One caution: Set-NetIPAddress on the interface you are connected through will disconnect you. Use out-of-band access for address changes on a remote machine.
What happens
Get-NetAdapter returns one object per interface. Status is Up or Disconnected, LinkSpeed is a formatted string rather than a number, and MacAddress is the hardware address. Because these are objects, you can filter and sort them instead of reading through ipconfig output.
Worth remembering
- Test-NetConnection -Port tests a specific port; ping cannot.
- Get-NetIPConfiguration is the object-based ipconfig.
- These modules are Windows-only.
- Changing the address of your own connection path will disconnect you.
Primary documentation
Try it
Browser simulation · fictional data; no changes to your computer.
Follow the objects
Run the command to inspect each stage.
Lists network adapters with status, speed and MAC address.
Show reference output
Browser dataset output · the real environment will differ
Name Status LinkSpeed MacAddress --------------- ------------ --------- ----------------- Ethernet0 Up 1 Gbps AA-BB-CC-11-22-33 Wi-Fi Up 866 Mbps AA-BB-CC-44-55-66 Ethernet1 Down 1 Gbps AA-BB-CC-77-88-99 vEthernet (WSL) Up 10 Gbps AA-BB-CC-AA-BB-01 Bluetooth Disconnected 3 Mbps AA-BB-CC-AA-BB-02 VPN Up 100 Mbps AA-BB-CC-AA-BB-03 Loopback Up 10 Gbps AA-BB-CC-AA-BB-04 Ethernet2 Disabled 1 Gbps AA-BB-CC-AA-BB-05