Get All External IP details using PowerShell

Today, I wanted to share with you a PowerShell script that I’ve found particularly useful. It allows you to obtain detailed information about a specific external IP address.

Here’s the script:

Write-Host `n`n 'Get External ip informations :' -BackgroundColor Green -ForegroundColor Black
            # Get information about public ip adress : location , HostName , city, Region , postal , timezone...
            $ExternalIP = Read-Host("Please Enter External IP adress that you want to check location ") 
            Invoke-RestMethod -Uri https://ipinfo.io/$ExternalIP | Select-Object Ip, Hostname, City, Region, Country, @{label = "GPS Location";E={$_.loc}} , @{label ="Company";E={$_.org}}, @{label ="Postal Code";E={$_.postal}} , timezone

Here is execution results :

This script is ideal for network troubleshooting or for obtaining information on the location of a specific IP address. It uses the ipinfo.io API to retrieve information such as IP address, hostname, city, region, country, GPS location, company, zip code and time zone.

Give it a try and share your feedback!

Thanks

Aymen EL JAZIRI (Microsoft MVP)
Aymen EL JAZIRI (Microsoft MVP)

Hi, I’m Aymen El Jaziri , a passionate System Administrator and Microsoft MVP, with years of hands-on experience in managing and securing modern IT infrastructures.
This blog is where I share technical guides, automation scripts, product reviews, and real-world solutions that help IT professionals simplify their day-to-day work and stay ahead in a fast-evolving cloud ecosystem.
Whether you’re here to troubleshoot an issue, improve your automation game, or learn new best practices , welcome in my blog !
Let’s build a stronger, smarter IT community together.
Feel free to connect with me on LinkedIn for more content, discussions, or collaboration opportunities.

Thanks

Aymen

Articles: 154