< Back

Get-CIPAddress

Sun Jan 12, 2020 9:44 pm

NAME Get-CIPAddress



SYNOPSIS

Gets the IP addresses in use on the local computer.





SYNTAX

Get-CIPAddress [<CommonParameters>]



Get-CIPAddress [-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.NetworkInformat

ion.NetworkInterface](http://msdn.microsoft.com/en-us/library ... rface.aspx)

class's [GetAllNetworkInterfaces](http://msdn.microsoft.com/en-us/library ... etworkinte

rface.getallnetworkinterfaces.aspx) static method, e.g.



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





PARAMETERS

-V4 [<SwitchParameter>]

Return just IPv4 addresses.



Required? false

Position? named

Default value False

Accept pipeline input? false

Accept wildcard characters? false



-V6 [<SwitchParameter>]

Return just IPv6 addresses.



Required? false

Position? named

Default value False

Accept pipeline input? false

Accept wildcard characters? false



<CommonParameters>

This cmdlet supports the common parameters: Verbose, Debug,

ErrorAction, ErrorVariable, WarningAction, WarningVariable,

OutBuffer, PipelineVariable, and OutVariable. For more information, see

about_CommonParameters (https:/go.microsoft.com/fwlink/?LinkID=113216).



INPUTS



OUTPUTS

System.Net.IPAddress.





-------------------------- EXAMPLE 1 --------------------------



PS C:\\>Get-CIPAddress



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









-------------------------- EXAMPLE 2 --------------------------



PS C:\\>Get-CIPAddress -V4



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









-------------------------- EXAMPLE 3 --------------------------



PS C:\\>Get-CIPAddress -V6



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











RELATED LINKS

http://stackoverflow.com/questions/1069 ... dress-in-c