OK, I found some scripts and modified them to get my local LAN Addr, currently I have a static IP addr and I want to be able to retrieve
the Public IP which may or may not be static in the future... how would I query the router for that info? I am aware of sites such as
whatsmyip.com & org... but they bury in the return page or use additional references to the info making it a nightmare to extract that
data from the webpage.... is there a way to get Public IP and possibly DNS info... the script I am working will also be run on a couple
of Dynamic IP'd machines, so just because I know my info, it does not help if I cannot retrieve the info for the machine running the script.
Not all sites "bury in the return page or use additional references". Several sites provide the external IP address as the only content returned from an HTTP "Get" verb request. A total of 6 lines at the most. One such site is myexternalip.com.
ObjHttp = ObjectCreate("WinHttp.WinHttpRequest.5.1")
TimeoutVal = 59000
ObjHttp.SetTimeouts(TimeoutVal, TimeoutVal, TimeoutVal, TimeoutVal)
ObjHttp.Open("GET", "http://www.myexternalip.com/raw")
ObjHttp.Send()
strIP = ObjHttp.ResponseText
With regard to DNS it all depends on what you mean by "Dynamic IP'ed" machines. If are referring to machines obtaining their IP address via DHCP then it depends on whether or not the network edge router has a fixed external IP address and that IP address is associated with a domain. If those two conditions are true, you will likely be able to perform a simple DNS query on the domain to get the IP address. Obviously, this type of solution is limited to a unique set of circumstances.
DNS queries - both forward and reverse lookup - can easily be performed using either the IP Grabber, WinSock, or WinInet Extender.
[edit]: Of course, using a VPN would blow the fixed IP address approach out of the water and you would be back to an external host approach.