Updated July 2022: Stop getting error messages and slow down your system with our optimization tool. Get it now at this link
- Download and install the repair tool here.
- Let it scan your computer.
- The tool will then repair your computer.
You probably know that there are many websites that can find a public IP address. We know fairly well how to get a public IP address by going to those sites. That’s because it’s very simple. However, it would be really interesting to get a public IP address using PowerShell. Yes, using a simple command, you can find the public IP address of the computer you are working on.
Most of us know that a system IP address can be known by executing a simple command. For Windows machines, you can run ipconfig and for Linux, it’s the ifconfig command. If you have an internet connection from your ISP, the system is usually behind a router or modem. Using the router’s administration page, you can always find your public IP address. You need to connect to your router and check the configuration.
How to Get your Public IP Address Using PowerShell in Windows 10
To find out your external IP address, you can use any online service. You can obtain data from an external PowerShell web page using the Invoke-WebRequest cmdlet.
You can scan the page of any popular site to check the external IP address, but it is easier to use services that only contain the IP address (in plain text form).
You can use the following sites:
For example, to find out your current external IP address from which you are accessing the Internet, open the PowerShell console and run the command:
(Invoke-WebRequest -uri "http://ifconfig.me/ip").Content
As you can see, the command managed to return to the PoSh console the external IP address where the connection came from.
Or you can even get your GeoIP data (such as country, city, region and GPS coordinates).
Invoke-RestMethod -Uri ('http://ipinfo.io/'+(Invoke-WebRequest -uri "http://ifconfig.me/ip").Content
You must understand that in most cases, the resulting IP will not be the true static “white” IP of your computer. In most cases, it will be either the external IP address of the router (if using NAT), the dynamic IP address issued by the provider, or the proxy server address.
In the snapshot above, you can see all the details corresponding to your internet connection such as city, region, time zone, org, and others.
I hope this tutorial will help you find the IP address with other details as well. If you still have any doubts, you can leave your comments about this article.
Expert Tip: This repair tool scans the repositories and replaces corrupt or missing files if none of these methods have worked. It works well in most cases where the problem is due to system corruption. This tool will also optimize your system to maximize performance. It can be downloaded by Clicking Here
CCNA, Web Developer, PC Troubleshooter
I am a computer enthusiast and a practicing IT Professional. I have years of experience behind me in computer programming, hardware troubleshooting and repair. I specialise in Web Development and Database Design. I also have a CCNA certification for Network Design and Troubleshooting.