Identifying Origin of IP Address

by Apr 17, 2013

Ever wondered how a website knew which country you are from? That's because there are IP address segments assigned to certain regions. And here's a web service that you can use from PowerShell to test and find out where a given IP address is located:

$ip = '64.4.11.37'


$geoip = New-WebServiceProxy 'http://www.webservicex.net/geoipservice.asmx?WSDL' 
$geoip.GetGeoIP($ip)

The result looks similar to this:

Note that for New-WebServiceProxy to work, you need direct Internet access or else may have to use -Credential to submit logon details.

If you'd instead like to know the IP address that your ISP has assigned to you, and find out where you are currently located, use GetGeoIPContext():

Twitter This Tip! ReTweet this Tip!