Wednesday, November 08, 2006
Searching DHCP
We all know the DHCP console sucks for searching. The columns don't sort accurately and it's hard to find a specific system, especially in a large scope. Netsh to the rescue!
where
Example:
Example:
Find a reservation
netsh -r servername dhcp server scope scopeaddress dump | find /i "searchvalue"
where
servername
is the name or IP address of the DHCP server on which the scope is defined, scopeaddress
is the IP address of the scope in question, and searchvalue
is the client IP address, MAC address (undelimited), computer name or text description (/i ignores case). Example:
netsh -r dhcpsvr1 dhcp server scope 192.168.100.0 dump | find /i "aaron-laptop"
dhcp Server 192.168.1.1 Scope 192.168.100.0 Add reservedip 192.168.100.42 01234567890a "aaron-laptop." "Aaron Czechowski" "BOTH"
Find a lease
netsh -r servername dhcp server scope scopeaddress show clients | find /i "searchvalue"
searchvalue
options: IP address, MAC address (hyphen delimted). Example:
netsh -r dhcpsvr1 dhcp server scope 192.168.100.0 show clients | find /i "01-23-45-67-89-0a"
192.168.100.42 - 255.255.255.0- 01-23-45-67-89-0a -11/11/2006 8:05:23 PM -D