Powershell One-Liner to Search DHCP for a IP address of a MAC Address

By | October 25, 2016

So, I recently had a need to quickly and easily search a considerably large amount of DHCP Pools for some Polycom Trio devices. and James Cussens VVX manager returned too many results to find what I was looking for (well, until I hacked it to support Trio’s)

Bascially, feed it a MAC and it will return the IP if the DHCP server has leased it.

Figured someone else would find this handy. Run this from a host with the DHCP tools installed. it will poll the local machine by default, but you can just update the machine name and mac address as required.

1
Get-DhcpServerv4Scope | foreach {Get-DhcpServerv4Lease -computername $env:computername -allleases -ScopeId ($_.ScopeId) as [string] } | ? clientid -match '00-04-f2-f' 

Enjoy.

 

One thought on “Powershell One-Liner to Search DHCP for a IP address of a MAC Address

Leave a Reply