PowerShell Commands

Get-NetIPConfiguration

Get-NetIPConfiguration [[-InterfaceAlias] <String>] [-All*Compartments] [-CimSession <CimSession>] [-CompartmentId<Int32>] [-Detailed] [<CommonParameters>]
Get-NetIPConfiguration [-All*Compartments] [-CimSession <CimSession>] [-CompartmentId <Int32>] [-Detailed] -All[<CommonParameters>]
Get-NetIPConfiguration [-All*Compartments] [-CimSession <CimSession>] [-CompartmentId <Int32>] [-Detailed]-InterfaceIndex* <Int32> [<CommonParameters>]

The Get-NetIPConfiguration cmdlet gets network configuration, including usable interfaces, IP addresses, and DNS servers.

If you do not specify any parameters, this cmdlet gets IP configuration properties for all non-virtual connected interfaces on a computer.

Parameters

-All <SwitchParameter>

  • This value is required

Indicates that the cmdlet retrieves the IP configuration properties for all of the interfaces on a computer, including virtual interfaces, loopback interfaces, and disconnected interfaces.

-AllCompartments [<SwitchParameter>]

Indicates that the cmdlet gets the IP configuration properties for all of the compartments on a computer.

-CimSession [<CimSession>]

  • Accepts pipeline input ByPropertyName

Runs the cmdlet in a remote session or on a remote computer. Enter a computer name or a session object, such as the output of a New-CimSession or Get-CimSession cmdlet. The default is the current session on the local computer.

-CompartmentId [<Int32>]

  • Accepts pipeline input ByPropertyName

Specifies an identifier for network compartment in the protocol stack. By default, the cmdlet gets Net IP configuration in the default compartment. If you specify a value for this parameter, the cmdlet gets any matching Net IP configuration in the compartment specified in this field.

-Detailed [<SwitchParameter>]

Indicates that the cmdlet retrieves additional interface and computer configuration information, including the computer name, link layer address, network profile, MTU length, and DHCP status.

-InterfaceAlias [<String>]

  • Accepts pipeline input ByPropertyName

Specifies an alias of a network interface. The cmdlet gets an IP configuration that matches the alias.

-InterfaceIndex <Int32>

  • This value is required
  • Accepts pipeline input ByPropertyName

Specifies an index of a network interface. The cmdlet gets an IP configuration that matches the index.

<CommonParameters>

This cmdlet supports the common parameters: Verbose, Debug,ErrorAction, ErrorVariable, WarningAction, WarningVariable,OutBuffer, PipelineVariable, and OutVariable.

Inputs
None
Outputs
None
Examples
  1. Get the IP configuration:
    PS C:\> Get-NetIPConfiguration
    

    This command gets IP configuration information. When this cmdlet is run without parameters, it gets the IP configuration information for all of the non-virtual connected interfaces on the computer.

  2. Get all IP configuration details:
    PS C:\> Get-NetIPConfiguration -All
    

    This command gets the IP configuration information for all of the interfaces on the computer, including virtual interfaces, loopback interfaces, and disconnected interfaces.

  3. Get the IP configuration information with a common parameter:
    PS C:\> Get-NetIPConfiguration -Verbose
    

    This command gets IP configuration information. By using the Verbose parameter, the networking cmdlets are shown to gather and format the information displayed in this cmdlet.

  4. Get the IP configuration by interface index:
    PS C:\> Get-NetIPConfiguration -InterfaceIndex 12
    

    This command gets the IP configuration information for the interface at the index 12.

  5. Get the IP configuration from pipeline input:
    PS C:\> Get-NetIPConfiguration | Get-NetIPAddress
    

    This command gets the IP address information, including the prefix length.

This work is licensed under a Creative Commons Attribution 4.0 International. It is attributed to Microsoft Corporation and can be found here.

PowerShell Commands