Get-IPAddress

Gets the IP addresses in use on the local computer.

Syntax

Get-IPAddress [<CommonParameters>]
Get-IPAddress [-V4] [-V6] [<CommonParameters>]

Description

The .NET API for getting all the IP addresses in use on the current computer's network intefaces is pretty cumbersome. If all you care about is getting the IP addresses in use on the current computer, and you don't care where/how they're used, use this function.

If you do care about network interfaces, then you'll have to do it yourself using the System.Net.NetworkInformation.NetworkInterface class's GetAllNetworkInterfaces static method, e.g.

[Net.NetworkInformation.NetworkInterface]::GetNetworkInterfaces()

Related Commands

Parameters

Name Type Description Required? Pipeline Input Default Value
V4 SwitchParameter

Return just IPv4 addresses.

false false False
V6 SwitchParameter

Return just IPv6 addresses.

false false False

Return Values

System.Net.IPAddress.

EXAMPLE 1

Get-IPAddress

Returns all the IP addresses in use on the local computer, IPv4 and IPv6.

EXAMPLE 2

Get-IPAddress -V4

Returns just the IPv4 addresses in use on the local computer.

EXAMPLE 3

Get-IPADdress -V6

Retruns just the IPv6 addresses in use on the local computer.