Skip to content

Get‑LinkLayerAddress

viscalyxbot edited this page Sep 15, 2025 · 1 revision

SYNOPSIS

Cross-platform replacement for Get-NetNeighbor that returns the MAC address for an IP address on the local subnet/VLAN.

SYNTAX

Get-LinkLayerAddress [-IPAddress] <String> [<CommonParameters>]

DESCRIPTION

The Get-LinkLayerAddress command retrieves the Media Access Control (MAC) address for a specified IP address that is on the local subnet or VLAN. This command works across different operating systems including Windows, Linux, and macOS by using the appropriate platform-specific tools and commands to query the ARP table or neighbor cache.

EXAMPLES

EXAMPLE 1

Get-LinkLayerAddress -IPAddress '192.168.1.42'

Returns the MAC address for the computer with IP address 192.168.1.42 on the local subnet.

EXAMPLE 2

'192.168.1.10', '192.168.1.20' | Get-LinkLayerAddress

Returns the MAC addresses for multiple IP addresses using pipeline input.

EXAMPLE 3

Get-MacAddress -IPAddress '10.0.0.5'

Uses the alias 'Get-MacAddress' to retrieve the MAC address for IP address 10.0.0.5.

PARAMETERS

-IPAddress

Specifies the IP address for which to retrieve the MAC address. The IP address must be on the same subnet/VLAN as the local computer and the target computer must be reachable.

Type: String
Parameter Sets: (All)
Aliases:

Required: True
Position: 1
Default value: None
Accept pipeline input: True (ByValue)
Accept wildcard characters: False

CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.

INPUTS

System.String

IP address as string for pipeline input.

OUTPUTS

System.String

MAC address in standard format (e.g., '00:11:22:33:44:55').

NOTES

The target computer must be powered on and reachable on the network for the MAC address to be retrieved successfully. This command first sends a ping to refresh the ARP table entry before attempting to retrieve the MAC address.

RELATED LINKS

Clone this wiki locally