If you can get it to work, the beauty of whatismyip.org is that there is absolutely no extraneous stuff to parse out and get rid of. As you've seen, whatismyip.com has got all kinds of content that is probably dynamic, and would be a pain to deal with.
In truth, I used to use checkip.dyndns.org and process the result to get rid of the html tags and phrase "Current IP Address:" When I saw whatismyip.orgmentioned this morning I simplified the script to take advantage of the ultra-lean nature of that site's output. On Fri, Jun 24, 2011 at 12:45 PM, Kurt Buff <[email protected]> wrote: > More interesting. > > http://whatismyip.com yields a web page that actually does show my > external IP address, along with a bunch of other stuff, but I get an > error when using that in the script. I will play around with this some > more. > > Kurt > > On Fri, Jun 24, 2011 at 07:38, Michael B. Smith <[email protected]> > wrote: > > Actually, I think your solution is really good. I can think of a couple > of > > places where I’ll use my modification of your solution. > > > > > > > > After all, you came up with the idea. That’s well over half the job. > > > > > > > > Regards, > > > > > > > > Michael B. Smith > > > > Consultant and Exchange MVP > > > > http://TheEssentialExchange.com <http://theessentialexchange.com/> > > > > > > > > From: Richard Stovall [mailto:[email protected]] > > Sent: Friday, June 24, 2011 10:35 AM > > > > To: NT System Admin Issues > > Subject: Re: Get external IP from command line > > > > > > > > I never said that I know what I'm doing with Powershell... > > > > > > > > :) > > > > > > > > PS Why do my eyes hurt all of a sudden? > > > > On Fri, Jun 24, 2011 at 10:16 AM, Michael B. Smith < > [email protected]> > > wrote: > > > > Ah heck, you can do that in one (long) line of PowerShell, even with > spaces > > added for readability. J J > > > > > > > > ( ( [text.encoding]::ASCII.GetString( (new-object > > net.webclient).DownloadData( "http://whatismyip.org" ) ) ) + ", " + > > (get-date).ToShortDateString() + ", " + (get-date).ToShortTimeString() ) > >>>file.txt > > > > > > > > Regards, > > > > > > > > Michael B. Smith > > > > Consultant and Exchange MVP > > > > http://TheEssentialExchange.com <http://theessentialexchange.com/> > > > > > > > > From: Richard Stovall [mailto:[email protected]] > > Sent: Friday, June 24, 2011 10:09 AM > > To: NT System Admin Issues > > Subject: Re: Get external IP from command line > > > > > > > > Well, what to do with the information is a different question from what > the > > OP asked. I was just offering another method of accomplishing the task > at > > hand. > > > > > > > > When I used to use that script I was only interested in having an > > ongoing record of when my ip changed. Nothing more than that. I didn't > > even care what the ip was. Now I can't remember why I wanted to know > when > > it changed... > > > > On Fri, Jun 24, 2011 at 9:31 AM, John Aldrich < > [email protected]> > > wrote: > > > > Yes, but what do you *do* with that info? I'm in a similar situation > where I > > access my machine at home. I'm on a dynamic IP as well, but I run an > > application to update my dynamic DNS entry based on similar information > to > > whatismyip.com. Thus, I only have to wait about 15 or 20 minutes after > the > > IP changes to be able to access my machine at home again. :D > > > > Sometimes I think my ISP (Windstream) detects a large amount of traffic > on > > my machine and decides to change my IP. Too bad I've figured out a > > work-around. :D > > > > > > > > From: Richard Stovall [mailto:[email protected]] > > Sent: Friday, June 24, 2011 9:18 AM > > To: NT System Admin Issues > > Subject: Re: Get external IP from command line > > > > Here's a little Powershell script to accomplish the same thing and write > the > > result out to a history file. I've used this via a scheduled task on my > > home machine to track when my FIOS ip changes. > > > > $url = "http://whatismyip.org/" > > $wc = new-object system.net.webclient > > $data = $wc.DownloadData($url) > > $ip = [System.Text.Encoding]::ASCII.GetString($data) > > $date = get-date > > $writestr = $ip + "," + " " + $date.toshortdatestring() + "," + " " + > > $date.ToShortTimeString() > > add-content C:\somepath\ip.txt $writestr > > On Fri, Jun 24, 2011 at 3:23 AM, Gavin Wilby <[email protected]> > wrote: > > Stolen from another website, but this seems to work OK: > > > > > > Create a file named ip.vbs and copy the following into it: > > > > Option Explicit > > Dim http : Set http = CreateObject( "MSXML2.ServerXmlHttp" ) > > http.Open "GET", "http://whatismyip.org", False > > http.Send > > Wscript.Echo http.responseText 'or do whatever you want with it > > Set http = Nothing > > > > Execute using > > > > C:\>cscript ip.vbs > > > > > > On Fri, Jun 24, 2011 at 7:59 AM, Oliver Marshall > > <[email protected]> wrote: > >> > >> Hi chaps > >> > >> > >> > >> Does anyone know of a command line tool that can return the external IP > of > >> the machine it’s run on? I need to run a script on some machines and > need to > >> note the external IP. > >> > >> Olly > >> > >> > >> > >> > >> > >> Network Support > >> Online Backups > >> Server Management > >> > >> Tel: 0845 307 3443 > >> > >> Email: [email protected] > >> > >> Web: http://www.g2support.com > >> > >> Twitter: g2support > >> > >> Newsletter: http://www.g2support.com/newsletter > >> > >> Mail: 2 Roundhill Road, Brighton, Sussex, BN2 3RF > >> > >> > >> > >> Have you said something nice about us to a friend or colleague ? > >> > >> Let us say thanks. Find out more at www.g2support.com/referral > >> > >> > >> > >> G2 Support LLP is registered at Mill House, 103 Holmes Avenue, HOVE > >> > >> BN3 7LE. Our registered company number is OC316341. > >> > >> ~ Finally, powerful endpoint security that ISN'T a resource hog! ~ > >> ~ <http://www.sunbeltsoftware.com/Business/VIPRE-Enterprise/> ~ > >> > >> --- > >> To manage subscriptions click here: > >> http://lyris.sunbelt-software.com/read/my_forums/ > >> or send an email to [email protected] > >> with the body: unsubscribe ntsysadmin > > > > -- > > Gavin Wilby, > > Twitter: http://twitter.com/gavin_wilby > > GSXR Blog: http://www.stoof.co.uk > > > > ~ Finally, powerful endpoint security that ISN'T a resource hog! ~ > > ~ <http://www.sunbeltsoftware.com/Business/VIPRE-Enterprise/> ~ > > > > --- > > To manage subscriptions click here: > > http://lyris.sunbelt-software.com/read/my_forums/ > > or send an email to [email protected] > > with the body: unsubscribe ntsysadmin > > > > ~ Finally, powerful endpoint security that ISN'T a resource hog! ~ > > ~ <http://www.sunbeltsoftware.com/Business/VIPRE-Enterprise/> ~ > > > > --- > > To manage subscriptions click here: > > http://lyris.sunbelt-software.com/read/my_forums/ > > or send an email to [email protected] > > with the body: unsubscribe ntsysadmin > > > > > > ~ Finally, powerful endpoint security that ISN'T a resource hog! ~ > > ~ <http://www.sunbeltsoftware.com/Business/VIPRE-Enterprise/> ~ > > > > --- > > To manage subscriptions click here: > > http://lyris.sunbelt-software.com/read/my_forums/ > > or send an email to [email protected] > > with the body: unsubscribe ntsysadmin > > > > > > > > ~ Finally, powerful endpoint security that ISN'T a resource hog! ~ > > ~ <http://www.sunbeltsoftware.com/Business/VIPRE-Enterprise/> ~ > > > > --- > > To manage subscriptions click here: > > http://lyris.sunbelt-software.com/read/my_forums/ > > or send an email to [email protected] > > with the body: unsubscribe ntsysadmin > > > > ~ Finally, powerful endpoint security that ISN'T a resource hog! ~ > > ~ <http://www.sunbeltsoftware.com/Business/VIPRE-Enterprise/> ~ > > > > --- > > To manage subscriptions click here: > > http://lyris.sunbelt-software.com/read/my_forums/ > > or send an email to [email protected] > > with the body: unsubscribe ntsysadmin > > > > > > > > ~ Finally, powerful endpoint security that ISN'T a resource hog! ~ > > ~ <http://www.sunbeltsoftware.com/Business/VIPRE-Enterprise/> ~ > > > > --- > > To manage subscriptions click here: > > http://lyris.sunbelt-software.com/read/my_forums/ > > or send an email to [email protected] > > with the body: unsubscribe ntsysadmin > > > > ~ Finally, powerful endpoint security that ISN'T a resource hog! ~ > > ~ <http://www.sunbeltsoftware.com/Business/VIPRE-Enterprise/> ~ > > > > --- > > To manage subscriptions click here: > > http://lyris.sunbelt-software.com/read/my_forums/ > > or send an email to [email protected] > > with the body: unsubscribe ntsysadmin > > ~ Finally, powerful endpoint security that ISN'T a resource hog! ~ > ~ <http://www.sunbeltsoftware.com/Business/VIPRE-Enterprise/> ~ > > --- > To manage subscriptions click here: > http://lyris.sunbelt-software.com/read/my_forums/ > or send an email to [email protected] > with the body: unsubscribe ntsysadmin > > ~ Finally, powerful endpoint security that ISN'T a resource hog! ~ ~ <http://www.sunbeltsoftware.com/Business/VIPRE-Enterprise/> ~ --- To manage subscriptions click here: http://lyris.sunbelt-software.com/read/my_forums/ or send an email to [email protected] with the body: unsubscribe ntsysadmin
