How to Get your Public IP Address Using PowerShell



Updated November 2022: Stop getting error messages and slow down your system with our optimization tool. Get it now at this link
  1. Download and install the repair tool here.
  2. Let it scan your computer.
  3. 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.



November 2022 Update:

You can now prevent PC problems by using this tool, such as protecting you against file loss and malware. Additionally it is a great way to optimize your computer for maximum performance. The program fixes common errors that might occur on Windows systems with ease - no need for hours of troubleshooting when you have the perfect solution at your fingertips:

  • Step 1 : Download PC Repair & Optimizer Tool (Windows 10, 8, 7, XP, Vista – Microsoft Gold Certified).
  • Step 2 : Click “Start Scan” to find Windows registry issues that could be causing PC problems.
  • Step 3 : Click “Repair All” to fix all issues.

download



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:

  • http://ipinfo.io/ip
  • http://ifconfig.me/ip
  • http://icanhazip.com
  • http://ident.me
  • http://smart-ip.net/myip

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.

Conclusion

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.

https://thesysadminchannel.com/find-your-public-ip-address-using-powershell/



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