IP Address Geo-Location

IP Address Geo-Location

PowerShell script that uses a free IP geolocation API (ip-api.com) to get the location of an IP address. Please note that the accuracy of the location

Reading and Writing to SQL Databases with PowerShell
IIS with ASP.NET support check
Managing VMware Snapshots with Powershell

PowerShell script that uses a free IP geolocation API (ip-api.com) to get the location of an IP address. Please note that the accuracy of the location may vary.

# Define the target IP address
$targetIP = "8.8.8.8"

# Send a request to the IP geolocation API
$response = Invoke-RestMethod -Uri "http://ip-api.com/json/$targetIP"

# Print the location information
Write-Output "IP: $($response.query)"
Write-Output "City: $($response.city)"
Write-Output "Region: $($response.regionName)"
Write-Output "Country: $($response.country)"
Write-Output "ZIP: $($response.zip)"
Write-Output "ISP: $($response.isp)"
Write-Output "Lat, Lon: $($response.lat), $($response.lon)"

This script will output the IP address, city, region, country, ZIP code, ISP, and latitude/longitude coordinates of the target IP address. You can replace "8.8.8.8" with the IP address you want to look up.

Please note that this script uses a free API, which has some limitations on the number of requests you can make per minute. For a more robust solution, you might want to consider using a paid IP geolocation service.

COMMENTS

WORDPRESS: 0