Get NetIPAddress - PowerShell


Overview

Get-NetIPAddress retrieves information about the network IP addresses assigned to a specified network interface or all interfaces on a local computer. It provides detailed data on IP addresses, network adapters, IP configurations, and related network properties.

Syntax

Get-NetIPAddress [-InterfaceAlias <string>] [-Confirm] [-OutFile <string>]
[-OutVariable <string>] [<CommonParameters>]

Options/Flags

  • -InterfaceAlias: Specifies the network interface alias to retrieve information for.
  • -Confirm: Prompts for confirmation before deleting an IP address.
  • -OutFile: Saves the output to a specified text file.
  • -OutVariable: Stores the output in a specified variable.

Examples

Get IP addresses for a specific interface:

Get-NetIPAddress -InterfaceAlias "Ethernet"

Get all IP addresses on the local computer:

Get-NetIPAddress

Save IP address information to a file:

Get-NetIPAddress -OutFile "IPAddresses.txt"

Common Issues

  • Missing interface alias: Ensure the specified interface alias is valid. use Get-NetAdapter to list available interfaces.
  • Access denied: Verify you have sufficient privileges to run the command.

Integration

Get network connectivity status:

Get-NetIPAddress | Test-NetConnection

Configure network adapter IP settings:

Get-NetIPAddress -InterfaceAlias "Ethernet" | Set-NetIPConfiguration
  • Get-NetAdapter: Retrieves information about network adapters.
  • Set-NetIPAddress: Modifies or sets IP addresses on network interfaces.
  • New-NetIPAddress: Creates new IP addresses on specified interfaces.