How to Find a DHCP Lease by MAC Address in Active Directory

Sometimes it can be hard to track down a DHCP lease with a GUI.

Powershell is awesome, but there’s such a learning curve, so posting this here in hopes it helps someone one day save some time.

The gist is that you need to search for a MAC address and you don’t want to go poking through all of the scopes on your DHCP server.

Assign DHCP Scope and Lease to a Variable

First step is to get both the scope and the leases for your DHCP server with assigning that information to a $result variable.

$result = @(Get-DhcpServerv4Scope -ComputerName servername | Get-DhcpServerv4Lease -ComputerName servername -AllLeases -Verbose)

Then,  you will search through the $result variable and find the MAC address through the client id column

Lookup MAC Address with Where-Object

$result | Where-Object clientid -Match 94-be-46-00-11-22

This will return a table with any matching MAC addresses and their lease expirations.

| IPAddress | ScopeId | ClientId | HostName | AddressState | LeaseExpiryTime
| 10.72.81.2 | 10.72.80.0 | 94-be-46-00-11-22 | - | ActiveReservation | - |
| 10.74.81.1 | 10.74.80.0 | 94-be-46-00-11-22 | - | Active | 2/13/2021 1:11:28 PM

This can come in handy if you have access points that are on two different DHCP scopes, but close enough to a device for it to roam between those APs.

Found the original post here that talks about going through an entire Active Directory Forest with a more detailed approach and multiple servers.