Get your public IP Address with PowerShell

Hello,

Not very useful, but, if you ever need to know your public internet IP address, you can use :

Function Get-MyPublicIP {
(Invoke-WebRequest -Uri ifconfig.me).RawContent -match "b(?:d{1,3}.){3}d{1,3}b" | Out-Null
$matches | select -ExpandProperty Values
}
Get-MyPublicIP

 

0 thoughts on “Get your public IP Address with PowerShell

  1. Hi M.DEMILLIERE,

    The website you use (ifconfig.me) seems to be down.
    You can replace it with ifconfig.co directly on your function

Leave a Reply