This cmdlet is part of the Vexasoft Cmdlet Library. You can download it now or click here to find out more.

Get-NetworkAdapter

Synopsis

Gets information about the network adapters in a local or remote computer.

Syntax

  • Get-NetworkAdapter [-Name] [-ComputerName] [-Credential]
  • Get-NetworkAdapter [-IPAddress] [-ComputerName] [-Credential]
  • Get-NetworkAdapter [-MACAddress] [-ComputerName] [-Credential]
  • Get-NetworkAdapter [-DynamicIP] [-ComputerName] [-Credential]
  • Get-NetworkAdapter [-StaticIP] [-ComputerName] [-Credential]
  • Get-NetworkAdapter [-Gateway] [-ComputerName] [-Credential]

Description

The Get-NetworkAdapter cmdlet is used to retrieve information about the network adapters and IP configuration of a local or remote machine. By default Get-NetworkAdapter returns an object for every network card found on the computer. However, you can specify which cards to return, filtering by Name, IP or MAC address, whether the adapter is using a static or DHCP address, or adapters that are configured to use a specific gateway.

Parameters

  • Name Get the network adapters with the following name. Wildcards are permitted. Cannot be used with any other parameters except ComputerName.
  • IPAddress Get the network adapters with the following IP address. Cannot be used with any other parameters except ComputerName.
  • MACAddress Get the network adapter with the following MAC address. Cannot be used with any other parameters except ComputerName.
  • DynamicIP Get network adapters with dynamically assigned (DHCP) addresses. Cannot be used with any other parameters except ComputerName.
  • StaticIP Get network adapters with static addresses. Cannot be used with any other parameters except ComputerName.
  • Gateway Get network adapters with the following gateway address. Cannot be used with any other parameters except ComputerName.
  • ComputerName The computer against which to run the cmdlet. By default this parameter will be populated with the name of the local computer.
  • Credential The credentials under which to run the cmdlet. By default this cmdlet will run as the current user. Using this parameter and the Get-PSCredential cmdlet you can specify an alternate set of credentials under which to execute this command.

Inputs

Get-NetworkAdapter accepts pipeline input only for the ComputerName parameter and requires that the input object contain a property named either Computer, CN or ComputerName.

Outputs

Get-NetworkAdapter outputs a custom object for each network adapter found in the target computer.

Notes

Get-NetworkAdapter outputs a custom object for a each network adapter found in a computer.

Example 1

This command will retrieve the hardware and IP configuration of all network adapters in the local computer:

C:\PS>Get-NetworkAdapter

Example 2

Identical to the first example but aimed at a remote machine, this command will retrieve the hardware and IP configuration of all network adapters in the computer PC01:

C:\PS>Get-NetworkAdapter -Computer PC01

Example 3

This command will retrieve the hardware and IP configuration of the adapter called 'Local Area Connection' on the local computer:

C:\PS>Get-NetworkAdapter -Name "local area connection"

Example 4

This command will retrieve the hardware and IP configuration of any adapters whose names begin with the word 'Local' on the remote computer PC01:

C:\PS>Get-NetworkAdapter -Name local* -ComputerName PC01

Example 5

This command will retrieve the hardware and IP configuration of the adapter with MAC address 00:ED:F1:01:0E:FF on the local computer, if found:

C:\PS>Get-NetworkAdapter -MAC 00:ED:F1:01:0E:FF

Example 6

This command will retrieve the hardware and IP configuration of the adapter with IP address 192.168.0.55 on the local computer, if found:

C:\PS>Get-NetworkAdapter -IP 192.168.0.55

Example 7

This command will retrieve the hardware and IP configuration of any adapters configured to use a static IP address on the local computer:

C:\PS>Get-NetworkAdapter -Static

Example 8

This command will retrieve the hardware and IP configuration of any adapters configured to use a dynamic, DHCP assigned IP addresses on the remote computer PC01:

C:\PS>Get-NetworkAdapter -Dynamic -Computer PC01

Example 9

This command will retrieve the hardware and IP configuration of any adapters configured to use the gateway at address 192.168.0.254 on the local computer:

C:\PS>Get-NetworkAdapter -Gateway 192.168.0.254