Windows Powershell One Liner script: Get External IP
This one is pretty straight forward. If you ever need to check your external IP address for informational purposes or want to verify an address change after connecting to a VPN connection, this simple windows powershell script should satisfy your needs. It displays your current external IP address.
Download this windows powershell script on github
How it works
First we use the Invoke-RestMethod cmdlet, which sends an HTTP or HTTPS request to a RESTful web service. We then enter the ipinfo.io url which is a website that returns various information about your External IP like hostname, city, country, location by latitude, longitude, and many other options. We then pipe the command to select only the ip, and thats pretty much it.
Interested in learning powershell?
Check out “Mastering Windows PowerShell Scripting – Second Edition: One-stop guide to automating administrative tasks“. This comprehensive guide starts from scratch and covers advanced-level topics to make you a PowerShell expert. The first module, PowerShell Fundamentals, begins with new features, installing PowerShell on Linux, working with parameters and objects, and also how you can work with .NET classes from within PowerShell.
We would also like to give a shout-out to Anuj over at Feedspot. Anuj was able to help us get listed on Feedspot’s “Top 50 Programming Blog”. If you don’t know what Feedspot is, it is a website where you can read your favorite Blogs, News websites, RSS Feeds, Youtube Channels and Social sites accounts from one place.
This post is located under the Programming Category
Enjoyed this post? Check out “How to create a windows password reset tool in powershell“