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.
Get-DhcpServerv4Scope | foreach {Get-DhcpServerv4Lease -computername $env:computername -allleases -ScopeId ($_.ScopeId) as [string] } | ? clientid -match '00-04-f2-f'
Enjoy.
The command didnt work for me. Sorry. Found this one liner much simpler et-DhcpServerv4Scope | Get-DhcpServerv4Lease -EA SilentlyContinue -ClientId 00-0c-29-dc-a5-3b
on https://thewayeye.net/2016/10/8/find-a-mac-microsoft-dhcp
Thanks for the feedback
You have to remove ‘as [string]’ and your command works.
Get-DhcpServerv4Scope | foreach {Get-DhcpServerv4Lease -computername $env:computername -allleases -ScopeId ($_.ScopeId)} | ? clientid -match ’00-04-f2-f’
Thanks mate!