Windows Vista Tips

Windows Vista Tips > Newsgroups > Windows Server > Scripting > Re: Can you query a DHCP server using netsh to display the IP address assigned to a MAC?

Reply
Thread Tools Display Modes

Re: Can you query a DHCP server using netsh to display the IP address assigned to a MAC?

 
 
F. Dunoyer
Guest
Posts: n/a

 
      07-10-2009

djackson88 a écrit :
> Hello,
>
> I am working with our Windows 2003 DHCP server at work via netsh and I
> am trying to optain the IP address of a client using the MAC address. I
> can run the following command:
>
> C:\Program Files\Common Files\IBM Tivoli>netsh dhcp server scope
> 10.40.0.0 show clients
>
> and it prints the output
>
> Changed the current scope context to 10.40.0.0 scope.
>
> Type : N - NONE, D - DHCP B - BOOTP, U - UNSPECIFIED, R - RESERVATION
> IP
> ================================================== ==============================
> ==
> IP Address - Subnet Mask - Unique ID - Lease Expires
> -T
> ype
> ================================================== ==============================
> ==
>
> 10.40.252.1 - 255.255.0.0 - 00-18-4d-db-ba-5f -7/14/2009
> 9:33:31 AM -
> D
> 10.40.252.2 - 255.255.0.0 - 00-1a-64-ae-2d-2e -7/14/2009
> 1:11:35 PM -
> D
> 10.40.252.3 - 255.255.0.0 - 00-1a-64-39-04-ea -7/14/2009
> 9:27:18 AM -
> D
> 10.40.252.4 - 255.255.0.0 - 00-14-5e-f4-0b-90 -7/14/2009
> 9:21:44 AM -
> D
> 10.40.252.5 - 255.255.0.0 - 00-14-5e-55-8d-38 -7/14/2009
> 9:41:21 AM -
> D
> 10.40.252.6 - 255.255.0.0 - 00-1a-64-39-04-e6 -7/14/2009
> 9:44:27 AM -
> D
> 10.40.252.7 - 255.255.0.0 - 00-0d-60-1c-c9-d3 -7/14/2009
> 9:44:54 AM -
> D
>
> What I would like to do is only display the IP address for the given
> Unique ID in my script which is a variable containing a MAC address. I
> have successuflly put the above information into a file by using the >
> C:\dhcp_dump.txt extension to my command but I do not know how to
> manipulate the output to only display or dump the single IP address
> assigned to the Unique ID/MAC listed above. Any suggestions?


netsh dhcp server scope 10.40.0.0 show clients | find "00-00-00-00-00"

better

set mac=00-00-00-00-00
netsh dhcp server scope 10.40.0.0 show clients | find "%MAC%"

--
François Dunoyer
Quelques textes qui m'ont séduit : http://fdunoyer.free.fr/textes.htm
Site perso : http://fds.mvps.org
Blog perso : http://fdunoyer.spaces.live.com/
Blog : http://fds34.spaces.live.com/


 
Reply With Quote
 
 
 
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Both DHCP-assigned and static address on same NIC? Jacob Jensen Windows Vista Help 0 08-03-2007 01:40 PM
Server sees client with different IP address than DHCP assigned it chris seiter Virtual PC 6 04-14-2006 12:22 PM
netsh dhcp display problem MarcusB Windows Server 2 02-19-2006 04:24 PM
NIC assigned Static IP seeks DHCP address SD Windows Server 3 01-30-2006 07:05 PM
DHCP: how can a reserved IP address get assigned to another DHCP c Terry Windows Server 2 05-31-2005 11:18 PM



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59