Recommended Posts

Hello,

I'm writing a script to automatically nslookup using a remote server and add a dns entry to my local dns server.

so far I've written the bit that adds the dns entry... however I can't seem to figure out a way to resolve the name of the site using a remote name server.

strDNSCmdPath = "C:\Program Files\Support Tools\dnscmd.exe"
strDNSServer = "10.1.1.6"
strDNSZone = "org.uk"
'hopefully have the ip of the site here.
dim strSiteIP


strSite = InputBox("Enter site url")


'bit that needs to ns lookup using remote server and return the ip address into the var strSiteIP.


' Runs an internal command interpreter command.
Function RunCmd (ByVal cmd)
   RunCmd = Run("%ComSpec% /c " & cmd)
   End Function

' CREATE THE DNS ENTRY
'RunCmd strDNSCmdPath & " " & strDNSServer & " /RecordAdd " & strDNSZone & " " & strSite & " A " & strSiteIP

Is there a simple way of doing this?

Link to comment
https://www.neowin.net/forum/topic/603183-vbscript-dns-entry/
Share on other sites

Huh? Why would you want/need to do this exactly? The DNS server your using should be able to lookup ANY public reachable record. If your using a private DNS for your local network, then this local DNS should forward requests it can not handle to an upstream DNS (say your ISP or opendns, etc.) or it should lookup the nameservers for domains directly from the root servers, an then query the owning nameserver for records under that domain.

If you gave some details of what your trying to accomplish an why, I would be happy to help in anyway I can to accomplish your goal.

edit:

The 2 most common resolver clients are nslookup an dig ( yes dig can be used on windows) an there is a nslookup for linux.

in dig to lookup up something from a specific nameserver you would use;

dig @nameserver host.domain.tld

nslookup host.domain.tld nameserver

example using 4.2.2.2

dig @4.2.2.2 www.google.com

nslookup www.google.com 4.2.2.2

you can use a FQDN for the nameserver if the default nameserver your machine is using would be able to resolve the FQDN of the nameserver your wanting to query.

Edited by BudMan
This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.