I want to write a batch file to get the DNS numbers behind a router.

Page 1 of 2 12 LastLast

  1. Posts : 14
    Windows 7 Professional 64bit
       #1

    I want to write a batch file to get the DNS numbers behind a router.


    I do a lot of internet troubleshooting and would like to put a simple batch file in customers computers that will let me see their DNS numbers when they are using a router.
    I currently do this from a command prompt for Comast:

    nslookup
    set type=ns
    comcast.net

    It's been years since I wrote a batch file and so I just put these lines in notepad and labeled it dns.bat

    However, this just runs the first line, nslookup.
    Is there a command that will cause each line to run after Windows has performed the line above?

    Or, is there an easier way to do what I want to do?

    Thanks in advance!
      My Computer


  2. Posts : 212
    Windows 7 Ultimate x64 (Retail)
       #2

    NSLookup itself pulls up the first server IP of the two servers I have listed.
    Would it not be easier to simply open Network and Sharing Center, click Change Adapter Settings, right click on the Local Area Connection and select Properties, select IPv4, click properties?
    Note I am using servers I manually entered in.
      My Computer


  3. Posts : 1,965
    win 7 X64 Ultimate SP1
       #3

    Set Command


    The set command is use to enter a value for a variable. There is no defined variable for "type" that I am aware of. The same goes for your third command listed in your post. Probably that is the problem.
      My Computer


  4. Posts : 14
    Windows 7 Professional 64bit
    Thread Starter
       #4

    jebuchanan said:
    NSLookup itself pulls up the first server IP of the two servers I have listed.
    Would it not be easier to simply open Network and Sharing Center, click Change Adapter Settings, right click on the Local Area Connection and select Properties, select IPv4, click properties?
    Note I am using servers I manually entered in.
    It just gives me the ip of the router.
    And in Adapter Settings I can't see the DNS numbers using DHCP.
      My Computer


  5. Posts : 14
    Windows 7 Professional 64bit
    Thread Starter
       #5

    HammerHead said:
    The set command is use to enter a value for a variable. There is no defined variable for "type" that I am aware of. The same goes for your third command listed in your post. Probably that is the problem.
    I see.

    Any ideas on how to automate the whole procedure?
      My Computer


  6. Posts : 966
    Windows 7 Enterprise
       #6

    techs said:
    HammerHead said:
    The set command is use to enter a value for a variable. There is no defined variable for "type" that I am aware of. The same goes for your third command listed in your post. Probably that is the problem.
    I see.

    Any ideas on how to automate the whole procedure?
    @Hammerhead, using the 'set' command will create a variable with the value and stores it in volatile memory for the current console session. As soon as you close the console, the variable is cleared and forgotten

    @techs, try the command:
    nslookup -type=ns comcast.net

    For me, it returned:
    Code:
    Server:  xxxxxxx.aut.ac.nz
    Address:  156.62.8.1
    
    Non-authoritative answer:
    comcast.net     nameserver = dns101.comcast.net
    comcast.net     nameserver = dns103.comcast.net
    comcast.net     nameserver = dns102.comcast.net
    comcast.net     nameserver = dns105.comcast.net
    comcast.net     nameserver = dns104.comcast.net
    
    dns104.comcast.net      internet address = 68.87.68.244
    dns104.comcast.net      AAAA IPv6 address = 2001:558:100a:5:68:87:68:244
    dns101.comcast.net      internet address = 68.87.29.164
    dns101.comcast.net      AAAA IPv6 address = 2001:558:1002:a:68:87:29:164
    dns105.comcast.net      internet address = 68.87.72.244
    dns105.comcast.net      AAAA IPv6 address = 2001:558:100e:5:68:87:72:244
    dns103.comcast.net      internet address = 68.87.76.228
    dns103.comcast.net      AAAA IPv6 address = 2001:558:1014:c:68:87:76:228
    dns102.comcast.net      internet address = 68.87.85.132
    dns102.comcast.net      AAAA IPv6 address = 2001:558:1004:7:68:87:85:132
      My Computer


  7. Posts : 1,965
    win 7 X64 Ultimate SP1
       #7

    Good


    Xarden:

    Thanks for straightening me out.
      My Computer


  8. Posts : 966
    Windows 7 Enterprise
       #8

    No worries.
    Furthermore, the 'setx' command does the same but stores it as a system environment variable. Which you can use in different sessions, or after reboots.
    Just be careful that you dont overwrite an existing one, like 'path' for instance.


    @Techs,
    let us know how that goes for you.
      My Computer


  9. Posts : 14
    Windows 7 Professional 64bit
    Thread Starter
       #9

    xarden said:
    No worries.
    Furthermore, the 'setx' command does the same but stores it as a system environment variable. Which you can use in different sessions, or after reboots.
    Just be careful that you dont overwrite an existing one, like 'path' for instance.


    @Techs,
    let us know how that goes for you.
    Just back from vacation.
    I will test and let you know.
    thanks!
      My Computer


  10. Posts : 6,285
    Windows 10 Pro X64
       #10

    I use OpenDNS and doing the following:

    ipconfig /all | find "DNS Servers"

    returns this:

    DNS Servers . . . . . . . . . . . : 208.67.222.222
    DNS Servers . . . . . . . . . . . : fec0:0:0:ffff::1%1
    DNS Servers . . . . . . . . . . . : 208.67.222.222

    It shows both the IPV4 and IPV6 DNS servers available to me.
      My Computer


 
Page 1 of 2 12 LastLast

  Related Discussions
Our Sites
Site Links
About Us
Windows 7 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 7" and related materials are trademarks of Microsoft Corp.

© Designer Media Ltd
All times are GMT -5. The time now is 10:03.
Find Us