Finding Public IP Address

by Apr 24, 2013

Whenever a machine is connected to the Internet, it gets a public IP address (typically assigned by the ISP), and this public IP address is not identical to your machine's IP address.

In PowerShell 3.0, there is a new and extremely useful cmdlet called Invoke-WebRequest that you can use to contact web servers and download data. Here is a simple one-liner that tells you your current public IP address:

(Invoke-WebRequest '' -UseBasicParsing).Content

Note that you may need to add the -Proxy and –ProxyCredential parameters if you have a proxy server in place.

Twitter This Tip! ReTweet this Tip!