In some cases it can be useful to check your external IP Address within a PowerShell script.
So I created this little script:
1 2 3 4 5 6 |
$content = Invoke-WebRequest -Uri http://myip.world $co = $content.RawContent.split() $regex = [regex] "\b(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\b" $ip = $regex.Matches($co) | %{ $_.value } $ip |