Posts

Showing posts from February, 2022

How to get Public IP Using PowerShell

Image
How to Get My Public IP Address Using PowerShell If you want find your public IP address that are being logged when you communicate on the Internet you can use a website like: ipconfig.me   But what if you want to get it using a PowerShell script? That is in fact also possible by using the command: Invoke-WebRequest. PowerShell command to get your Public IP Address: (Invoke-WebRequest -uri "http://ifconfig.me/ip").Content Or (Invoke-WebRequest -uri "https://techthatworks.net/publicIP.php").Content This one line command can be very useful if you need the public IP address of a server without a webbrowser installed. E.g. a mailserver where you need to find out what IP address your server is presenting for other mailservers on the Internet. If you want to use this command in a script that maybe write something to a logfile, you can put the IP adresse in a variable and use it inside your script. $MyPublicIP = (Invoke-WebRequest -uri "http://ifconfig.me/ip").

Popular posts from this blog

Use PowerShell to Discover Network Switch and port number

How to get Public IP Using PowerShell

Use ChatGPT to write PowerShell Scripts