get the default proxy by Powershell

https://stackoverflow.com/questions/571429/powershell-web-requests-and-proxies

$proxyAddr = (get-itemproperty 'HKCU:SoftwareMicrosoftWindowsCurrentVersionInternet Settings').ProxyServer
$proxy = new-object System.Net.WebProxy
$proxy.Address = $proxyAddr
$proxy.useDefaultCredentials = $true

$url = "http://stackoverflow.com"
$wc = new-object system.net.WebClient
$wc.proxy = $proxy
$webpage = $wc.DownloadData($url)
$str = [System.Text.Encoding]::ASCII.GetString($webpage)
Write-Host $str
原文地址:https://www.cnblogs.com/chucklu/p/9705641.html