Find Your Public IP Address Using Powershell

Today I’m going to share with you how to find your public IP address using Powershell. There might be a time where you might need to sort through multiple public addresses and want to be able to find the WHOIS information rather quickly. To do that, we will use the site https://ipinfo.io/ and calling their API to use with Powershell. Here’s how you do it.

Find Public IP Address Using Powershell

PS C:\> Invoke-RestMethod -Uri https://ipinfo.io

ip       : redacted
hostname : redacted
city     : redacted
region   : California
country  : US
loc      : redacted
postal   : redacted
org      : redacted

PS C:\> Invoke-RestMethod -Uri https://ipinfo.io/

ip       :
hostname : google-public-dns-a.google.com
city     : Mountain View
region   : California
country  : US
loc      : 37.3860,-122.0840
postal   : 94035
phone    : 650
org      : AS15169 Google LLC

Find Public IP Powershell

So I’m not all for showing you my exact location however, I am all for showing you what Google’s public DNS server are. If you omit an IP address, by default it will show your information. However, if you append an IP address at the end it should give you the details regarding that IP.

5/5 - (10 votes)

Paul Contreras

Hi, my name is Paul and I am a Sysadmin who enjoys working on various technologies from Microsoft, VMWare, Cisco and many others. Join me as I document my trials and tribulations of the daily grind of System Administration.

Leave a Reply

Your email address will not be published.