To get the network adapter IP address using PowerShell, use the Get-NetIPAddress cmdlet. The `Get-NetIPAddress
` command gets the IP address configuration such as IPv4 addresses, IPv6, subnet mask, default gateway, and other information about an IP address.
In this article, we will discuss how to get the network adapter IP address using the PowerShell Get-NetIPAddress command and get the IP address for the specific network adapter.
How to Get the IP addresses for All Network Adapters on a Computer
The Get-NetIPAddress
cmdlet in PowerShell can be used to get the IP addresses for all network adapters on a system.
Get-NetIPAddress | Format-Table
In the above PowerShell script, the Get-NetIPAddress command returns a list of objects, each of which represents an IP address. Each object has properties such as Interfacealias, IPAddress, SubnetMask, DefaultGateway, etc…
PS C:\> Get-NetIPAddress | Format-Table
ifIndex IPAddress PrefixLength PrefixOrigin SuffixOrigin AddressState
------- --------- ------------ ------------ ------------ ------------ ----------
1 ::1 128 WellKnown WellKnown Preferred
9 169.254.13.183 16 WellKnown Link Tentative
22 172.27.23.061 28 Manual Manual Preferred
11 192.168.131.5 24 Manual Manual Tentative
11 169.254.0.144 16 WellKnown Link Tentative
12 169.254.54.89 16 WellKnown Link Tentative
20 169.254.224.112 16 WellKnown Link Tentative
5 192.168.1.103 24 Dhcp Dhcp Preferred
1 127.0.0.1 8 WellKnown WellKnown Preferred
How to Get the IP Address for the Specific Network Adapter using PowerShell
To get the IP address for the specific network adapter named “Ethernet” using PowerShell, use the `Get-NetIPAddress
` command with -InterfaceAlias
parameter to specify the name network adapter name.
Get-NetIPAddress -InterfaceAlias Ethernet
The output of the above PowerShell script to find the IP address of the Ethernet network adapter is:
Cool Tip: How to get the network driver version using PowerShell!
Conclusion
I hope the above article on how to get the IP address of the network adapter using the PowerShell Get-NetIPAddress cmdlet is helpful to you.
You can find more topics about Active Directory tools and PowerShell basics on the ActiveDirectoryTools home page.