How to find out all the active clients serviced by your DHCP server

In this post, I am going to discuss about the various ways by which you can enumerate all the client leases of the DHCP server. The reasons why you might want to do this can be many:

You might want to do this when we want to have a single list of all clients your DHCP server is serving which automatically means that you want to know all the participants in your private LAN’s. You might need this information for administrative or for security reasons. (Let’s say whenever an unauthorized machine joins the network, you want to check it) Another interesting situation is when you want to maintain a database of all active network devices which are getting an IP address from the DHCP server in your favorite database for your own purposes.

You can do this through the following:

1) In the netsh, there is no command to create leases. But there is definitely a command to view the leases. What we need to do is go to each scope context via netsh and type the commands show clients


            Netsh dhcp server scope show clients


The above command will dump the leases in a human-readable form into the screen. We need to redirect the output to the text file. The information for each lease is represented by IP address, Hardware address and other misc info.

 2) Another way is perhaps use the DHCP server management API: to enumerate the active leases.

3) You can also do this from the MMC. This was a little surprising to me the first time I saw as I did not expect the granular data control that was made available. Go to the Address leases of each scope and right-click on the ‘Address Leases’ icon and clieck ‘Export List’ and you can dump the leases to a text file. Later you might want to parse this file (this contains the IP address and hardware address) and store it in your custom format.