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
