Would you like to know where a public IP address is located? Provided you have Internet access, you can query one of the public information services.
This example gets you the geolocation of an IP address. Make sure you replace the sample IP address with your own publicly exposed IP address. Go to websites like https://www.whatismyip.com/ to find out your IP address. If you use a private IP address, the web service cannot report back any geo location data obviously.
#requires -Version 3 $ipaddress = '126.96.36.199' $infoService = "http://freegeoip.net/xml/$ipaddress" $geoip = Invoke-RestMethod -Method Get -URI $infoService $geoip.Response