Thanks to the folks at FreeGeoIP.net, you can query their API for geolocation data by providing an IP address or Internet domain. The geolocation data can be produced in various formats including CSV, XML, and JSON. For this PowerShell snippet, we'll use the XML format.
Using Get-Geolocation I can retrieve location data for a public IP or online host. Here is an example.
UPDATE 9/16/2015: I found a free geolocation service called Telize that works great. The PowerShell commands below illustrate how easy it is to extract geolocation information from Telize.
Using the Invoke-RestMethod cmdlet, content can be queried from online geolocation providers to gather connection details such as public IP address and ISP location information. In this example I used a free service from ipecho.net to create the Get-PublicIP function. For older versions of PowerShell, you can use the Invoke-WebRequest cmdlet, but you must retrieve the IP address data from the object's content property.