Query a Windows DHCP server : find MAC from hostname

listed in answer

Query a Windows DHCP server : find MAC from hostname
0 votes, 0.00 avg. rating (0% score)

ANSWER:

If you are comfortable with Powershell, this script will help you find what you need:
https://sites.google.com/site/assafmiron/ServerScripts/get-dhcpleases

This script almost works as well. It currently lists extra clients. Some regex magic with the find command parameters could fix this. Save to to a .cmd file and specify your dhcppserver and a valid scope.

for /f "skip=4 delims=: tokens=2" %%a in ('nslookup %1') do set IP=%%a
netsh dhcp server \ourdhcpsvr scope 192.168.1.0 show clients|findstr "%IP%"

by uSlackr from http://serverfault.com/questions/378843