The Windows PowerShell command Get-NetIPAddress is a powerful tool for managing IP addresses on a Windows-based computer. It is used to retrieve information about the IP addresses configured on a computer, including the IP address, subnet mask, and default gateway. In this guide, we will discuss the syntax, parameters, inputs, outputs, examples, and tips for using the Get-NetIPAddress command.

Syntax

The syntax for the Get-NetIPAddress command is as follows:

Get-NetIPAddress [-InterfaceAlias] <String[]> [-AddressFamily] <AddressFamily> [-AddressState] <AddressState> [-CimSession <CimSession[]>] [-ThrottleLimit <Int32>] [-AsJob] [-IncludeAllCompartments] [-IncludeHidden] [-IncludeLinkLocal] [-IncludeLoopback] [-IncludeMulticast] [-IncludeSiteLocal] [-IncludeUnicast] [-PassThru] [-PreferredLifetime <TimeSpan>] [-PrefixOrigin <PrefixOrigin>] [-SuffixOrigin <SuffixOrigin>] [-ValidLifetime <TimeSpan>] [<CommonParameters>]

Parameters

The Get-NetIPAddress command has several parameters that can be used to customize the output. The parameters are as follows:

Parameter Description
-InterfaceAlias The name of the network interface.
-AddressFamily The address family of the IP address.
-AddressState The state of the IP address.
-CimSession The CIM session to use.
-ThrottleLimit The maximum number of concurrent operations.
-AsJob Run the command as a background job.
-IncludeAllCompartments Include all compartments in the output.
-IncludeHidden Include hidden IP addresses in the output.
-IncludeLinkLocal Include link-local IP addresses in the output.
-IncludeLoopback Include loopback IP addresses in the output.
-IncludeMulticast Include multicast IP addresses in the output.
-IncludeSiteLocal Include site-local IP addresses in the output.
-IncludeUnicast Include unicast IP addresses in the output.
-PassThru Pass the object through the pipeline.
-PreferredLifetime The preferred lifetime of the IP address.
-PrefixOrigin The origin of the IP address prefix.
-SuffixOrigin The origin of the IP address suffix.
-ValidLifetime The valid lifetime of the IP address.

Inputs

The Get-NetIPAddress command does not accept any inputs.

Outputs

The Get-NetIPAddress command returns a list of IP addresses configured on the computer, including the IP address, subnet mask, and default gateway.

Examples

The following example retrieves all IP addresses configured on the computer:

Get-NetIPAddress

The following example retrieves all IP addresses configured on the computer with the address family IPv4:

Get-NetIPAddress -AddressFamily IPv4

The following example retrieves all IP addresses configured on the computer with the address state Preferred:

Get-NetIPAddress -AddressState Preferred

Tips

Here are some tips for using the Get-NetIPAddress command:

  • Use the -InterfaceAlias parameter to specify the name of the network interface.
  • Use the -AddressFamily parameter to specify the address family of the IP address.
  • Use the -AddressState parameter to specify the state of the IP address.
  • Use the -CimSession parameter to specify the CIM session to use.
  • Use the -ThrottleLimit parameter to specify the maximum number of concurrent operations.
  • Use the -AsJob parameter to run the command as a background job.
  • Use the -IncludeAllCompartments parameter to include all compartments in the output.
  • Use the -IncludeHidden parameter to include hidden IP addresses in the output.
  • Use the -IncludeLinkLocal parameter to include link-local IP addresses in the output.
  • Use the -IncludeLoopback parameter to include loopback IP addresses in the output.
  • Use the -IncludeMulticast parameter to include multicast IP addresses in the output.
  • Use the -IncludeSiteLocal parameter to include site-local IP addresses in the output.
  • Use the -IncludeUnicast parameter to include unicast IP addresses in the output.
  • Use the -PassThru parameter to pass the object through the pipeline.
  • Use the -PreferredLifetime parameter to specify the preferred lifetime of the IP address.
  • Use the -PrefixOrigin parameter to specify the origin of the IP address prefix.
  • Use the -SuffixOrigin parameter to specify the origin of the IP address suffix.
  • Use the -ValidLifetime parameter to specify the valid lifetime of the IP

Leave a Reply