Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

DOS Command to check WAN I.P. Address 1

Status
Not open for further replies.

pritska

Technical User
Aug 13, 2001
114
KE
Hi,
Does anyone know of a command that can be used to check the WAN I.P Address, assigned or static, from ISP?

For example: I have a router which assigns addresses in the 192.168.x.x range. My ISP, gives me an I.P. in the 80.x.x.x range.

With ipconfig on any LAN machine, i can get it's I.P. address but I want to be able to check what the ISP assigned WAN I.P. address is. /all gives any local machine assigned dns servers, but NOT the WAN I.P.

Thanks.
 
Copy and paste the below into a notepad session, and save as WAN_IP.VBS :

------ begin copy/paste below this line

DateInfo = "WAN IP checked: " & Now & VbCrLf & VbCrLf

set http = createobject("microsoft.xmlhttp")
Http.open "GET"," ", false
Http.send
strng = Http.responsetext
DateInfo = DateInfo & " WAN IP: " & strng
Wscript.Echo DateInfo

------- end copy/paste above this line

You can:

. Create a new desktop shortcut. The target string would be:
wscript wan_ip.vbs

. Double click wan_ip.vbs in explorer

. At a CMD session prompt, type:
cscript wan_ip.vbs













From DOS you would type:
 
mhkwood,

The original poster asked for something that could be used in a DOS session. Your answer is not responsive.
 
bcastnet, thanks for your super VB trick. This will do me beautifully!

mhkwood, the reason I want it in a command or VB format is so
I can save it on my customers' desktops. This would in turn save me talking them through getting the IP from a website, which would only confuse some of the people i deal with.

If i can get them to just double click something on the desktop, it's a lot easier.

just tested it, works a treat!!!
 
Did not mean to step on any toes. I did understand that pritska was looking for a command line/script approach, and the script provided certainly does solve the problem.

I also read between the lines to ascertain the intended use. Under the circumstances described in pritska's second post, I think simply having the user type a web address that will report the required information is a cleaner solution.

To clarify, it certainly is easier to have someone double click an icon on the desktop than to have them type a web address. This does, however, require that you place the icon on the desktop in the first place and convince the user to leave it there. People have a tendancey to delete icons for things that they do not use on a regular basis. XP does not help this situation with the Desktop Cleanup Wizard running every 60 days (under a default installation). I usually place an icon for a VPN conneciton to my network on client's desktops, but I find that these are gone about 60% of the time.

I have had very good luck having clients (even the few that can't seem to figure out which mouse button is on the left and which is on the right) use it is a simple address and all they need to look at is the group of bold numbers at the top of the page. is much cleaner, but requires getting the slash in there.
 
My users will keep the icon as it makes life easier for them when they need to get the IP for me over the phone. I already know of the websites that tell you the I.P. The VERY point of this posting was to get a desktop shortcut created. Which has been achieved.
Thanks.
 
P.S. Bcastner, Do you have any other little scripts that can make life easier? Please share! :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top