Get public IP on a Windows Server via PowerShell


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

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

Invoke-RestMethod -uri

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


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


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.


Please enter your comment!
Please enter your name here