I'm very new to PowerShell scripting, but I'm trying to write a PowerShell script that will periodically check the computer's public IP address and then write it to a log file. The website http://checkip.dyndns.org/
returns the IP address. But when I use...
Invoke-WebRequest -Uri checkip.dyndns.org
...I end up with a bunch of extraneous text that I don't need. I'd like to pipe the output to some grep-like command that will just get the IP address, and nothing else. I've Googled around, and looked at some promising leads, but nothing seems to work for me. Also, the response time from the command is sometimes quick, but sometimes it takes 20 seconds or more to get the output. Not sure why that's happening.
Any suggestions would be much appreciated. Thanks.