Geolocate an IP Address from PowerShell recently published a tip, Identifying Origin of IP Address, that allows you to get the country of an IP Address. Seeing how this was built I decide to write a similar function that gathers a bit more information. The function provides information about the IP,Country,City and actual Latitude and Longtitude of an IP Address as provided by

Function Get-GeoIP {
param (
    ([xml](Invoke-WebRequest "$IP").Content).Response

The function takes an IP address as input and uses this to gather the results in XML-format from the website. This output is then presented to PowerShell as an Xml element. The output can also be filtered using the Select-Object Cmdlet.


Leave a Reply