Hi, I need to fetch details for a fixed mac-address hosts. I tried: /search?macaddress=00:11:22:333:44:55 but I only get the ip-address configured for this host. How can I get the gateway, mask and dns by mac-address? This host it's configured as fixed address. DHCP lookup to output fields for user, mac based on IP Address by lease time for all sourcetypes nathanluke86. Communicator 03:25 AM. This is a bad query. Extract the IP address and username from the DHCP log and match it with the FW IP address. Since I don't know the details of. O Query by MAC address: For this query, the requester supplies only a MAC address in the DHCPLEASEQUERY message. The DHCP server will return any information that it has on the IP address most recently accessed by a client with that MAC address. That will only work if they're on the same Ethernet network, which isn't always the case with, e.g., DHCP relay, and will also only work if this machine has communicated recently with the other machine (otherwise, it won't be in the arp cache) – derobert May 23 '14 at 18:01.
![Query dhcp for mac address Query dhcp for mac address](/uploads/1/1/8/5/118553248/103893559.png)
Many many moons ago, we had a way to trawl through DHCP scopes utilising the netsh tool to find devices on our networks that match a certain MAC address.
Instead of relying on such an outdated tool that isn’t on Microsoft’s radar to keep alive, I’ve cobbled together a function in Powershell aptly named Get-Mac to perform some duty which added functionality (and no required to log onto DHCP hosts).
The above function will by default, utilise the Get-DhcpServerInDC to return all your DHCP servers, obtain all their scopes with Get-DhcpServerv4Scope, look through each scopes lease with Get-DhcpServerv4Lease and finally match any lease with the MAC address provided. If you have a large enterprise network, comprises of multiple AD sites, then you can narrow the field down with the -DhcpSite together with the DNS name of your DHCP server in that site. Both the -Mac and the -DhcpSite switches work on wildcard matches so you won’t need the full address or full name of the DHCP server. Hopefully your AD sites have a naming convention which should assist narrowing it down.
Let me know if you found this one useful in your SysAdmin’ing day or think of improvements11.
There comes a point when you ask yourself, ‘there has to be a better way’ (this should be often). This was certainly the case where after a large campus switch out which required many printers to be reconfigure. Part of that reconfiguring was creating new DHCP reservation.
Unfortunately, if you do not cull the old lease, Windows (rightfully so) informs you there is already a device with that MAC in the reservation database. In someone’s at Microsoft’s infinite wisdom, they neglect to tell you what DHCP scope the device is currently reserved in. So I would begin to trawl each scope I guessed in maybe reserved in based on my knowledge of our current scopes. This would waste many minutes of my time (sometimes without success) which means my customers are getting less of me. No good.
But, I did ask myself, ‘there has to be a better way’…and there is!
![Query Dhcp For Mac Query Dhcp For Mac](/uploads/1/1/8/5/118553248/106230346.png)
Open up a command prompt window on your DHCP server (or a remote powershell session) and input the following:
All you need is the MAC address of the device and input it without ‘-‘ in the MACADDRESS space and you should get something a little like the below:
Dhcp Mac Address
Another time saver for the time poor SysAdmin