Results 1 to 2 of 2

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

  1. #1
    Join Date
    Jul 2009
    Posts
    1

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

    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?

  2. #2
    F. Dunoyer Guest

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

    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/



Similar Threads

  1. Replies: 5
    Last Post: 15-01-2011, 06:48 PM
  2. Unable to obtain a server-assigned IP address
    By dalsandhu in forum Networking & Security
    Replies: 3
    Last Post: 28-04-2009, 10:57 AM
  3. ISA not reflecting DHCP assigned IPs
    By tnai9 in forum Operating Systems
    Replies: 1
    Last Post: 06-10-2008, 06:42 PM
  4. netsh to set IP address on vista..
    By pdabak@yahoo.com in forum Vista Help
    Replies: 6
    Last Post: 12-02-2008, 07:57 AM
  5. Is there a way to query a DHCP server to get a list of MAC addresses?
    By mike_z@excite.com in forum Windows Server Help
    Replies: 7
    Last Post: 24-02-2006, 08:16 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,713,903,748.43955 seconds with 17 queries