Getting your Public IP through scripts

Getting your Public IP through scripts with powershell and bash

Last update: 2020-11-09

There are a lot of websites where you can get your public ip two of them are:

The only thing you need is making a GET request from your script:

Bash

curl ipinfo.io/ip

PowerShell

(Invoke-WebRequest -uri "http://ifconfig.me/ip").Content

References

http://woshub.com/get-external-ip-powershell/ https://linux.die.net/man/1/curl