Ever wanted to know your public IP address programmatically in PowerShell? Here’s a good oneliner for you:
(Invoke-WebRequest http://myip.eu ).ParsedHtml.body.innerText.Split()[15]
It will get a sample page from myip.eu page, parse this html page body and find in text only version a space splitted part with serial number 15. No warranty though that this page work forever and the page result is formatted the same in future. Still worth a try.
No comments:
Post a Comment