Wednesday, October 10, 2012

How to get a list of all the clients on a DHCP server.

I needed a list of client IPs and names from two MS DHCP servers. I tried several options before I found this quick command. I initially passed over netsh because it did not provide client names. Then I found out about the "1" parameter.

for /f %%j in ('"netsh dhcp server \\server01 show scope find /i "active""') do netsh dhcp server \\server01 scope %%j show clientsv5 1 >> DHCPClients.txt
for /f %%j in ('"netsh dhcp server \\server02 show scope find /i "active""') do netsh dhcp server \\server02 scope %%j show clientsv5 1 >> DHCPClients.txt

No comments: