Getting public IP on troubleshot networking issue is very useful. Especially, there is an issue with accessing your server from the external (public) network. Here is how to get your server’s public IP using PowerShell Invoke-RestMethod Command.

(Invoke-RestMethod -uri ipinfo.io/json).ip

Also, you can get the detail of your public IP by removing “ip” variable on the command above.

Invoke-RestMethod -uri ipinfo.io/json

There are numerous other services you can call to get the public IP, a few are below:

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

you can also get additional IP information, including the hostname, using ipinfo.io‘s JSON web service. You can also use ipinfo.io to get the IP information about another public IP Address. Just use the IP within the URL (ex: http://ipinfo.io/8.8.8.8/json)

invoke-restmethod

We hope this article can help you to check your public IP Address using PowerShell command. If you liked this article, then please share with the others. You can also find us on Twitter and Facebook.

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.