How to Use Windows PowerShell ‘Get-NetIPAddress’ for Network Audits

The Demise of ipconfig

For three decades, when a Windows administrator needed to know the IP address of a computer, they opened the command prompt and typed ipconfig (or ipconfig /all).

While ipconfig still works, it outputs a massive block of raw, unformatted text. If you are writing a script to deploy software, and that script needs to determine the IP address of the machine to decide which datacenter it is in, parsing the raw text of ipconfig using string manipulation is brittle and highly prone to error.

In modern Windows environments, IT professionals use the PowerShell cmdlet Get-NetIPAddress. It replaces raw text with structured, queryable data objects.

1. The Basic Object Audit

If you run the cmdlet by itself, it will dump a clean list of every IP address associated with the machine (including IPv4, IPv6, and hidden loopback addresses).

Get-NetIPAddress

Unlike ipconfig, this data is an object. You can instantly filter the results using standard PowerShell logic.

To strip away all the complex IPv6 addresses and only show the standard IPv4 addresses:

Get-NetIPAddress -AddressFamily IPv4

2. Filtering Out Loopbacks and Disconnected Adapters

In a script, you almost never care about the 127.0.0.1 localhost address, nor do you care about the Wi-Fi adapter if the laptop is currently hardwired into the corporate network.

You can chain filters to isolate the exact IP address that is currently routing traffic to the internet.

Get-NetIPAddress -AddressFamily IPv4 | Where-Object { $_.InterfaceAlias -notmatch "Loopback" }

The InterfaceAlias property clearly identifies the human-readable name of the hardware (e.g., “Ethernet” or “Wi-Fi”). By filtering out “Loopback”, you get a clean list of actual network interfaces.

3. Extracting the Raw IP Address for Scripts

If you are writing a deployment script that needs to store the physical IP address in a variable (so it can inject that IP into a configuration file later), you don’t want the formatting table. You just want the raw string (e.g., 192.168.1.50).

You achieve this by using the Select-Object cmdlet with the -ExpandProperty flag.

$myIP = Get-NetIPAddress -AddressFamily IPv4 -InterfaceAlias "Ethernet" | Select-Object -ExpandProperty IPAddress

Write-Host "The server IP is: " $myIP

This surgical precision is impossible with the legacy ipconfig tool.

4. Remote Network Audits

The true power of PowerShell is enterprise scale. If a remote server is experiencing network issues, you do not need to log into it to run ipconfig.

You can use the -CimSession parameter to execute Get-NetIPAddress on the remote machine and pull the network configuration directly back to your local laptop for analysis.

$session = New-CimSession -ComputerName SERVER-DB-01
Get-NetIPAddress -CimSession $session -AddressFamily IPv4 | Select-Object InterfaceAlias, IPAddress

This allows network engineers to rapidly map subnets and verify IP assignments across massive server farms without leaving their desk.

Conclusion

The Get-NetIPAddress cmdlet completely supersedes the legacy ipconfig utility for automation. By providing structured, filterable objects instead of raw text, it enables administrators to build highly resilient, context-aware network scripts.

Get the best tech tips delivered straight to your inbox.

Join thousands of readers mastering Apple, Google, Microsoft, and Linux.