Retrieve internet proxy server address via PowerShell

Solution 1:

Here is the PowerShell function to achieve my goal :

function Get-InternetProxy
                Determine the internet proxy address
                This function allows you to determine the the internet proxy address used by your computer
                Author : Antoine DELRUE 

    $proxies = (Get-ItemProperty -Path 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Internet Settings').proxyServer

    if ($proxies)
        if ($proxies -ilike "*=*")
            $proxies -replace "=","://" -split(';') | Select-Object -First 1

            "http://" + $proxies

enter image description here

Hope this helps !

Solution 2:

[System.Net.WebProxy]::GetDefaultProxy() | select address

[System.Net.WebProxy] is an object and one of its static methods is GetDefaultProxy(). The select shows for us from all the columns, what interests us, and it is the address.