zl程序教程

您现在的位置是:首页 >  其它

当前栏目

get the default proxy by Powershell

The get by Proxy Default PowerShell
2023-09-11 14:14:21 时间

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

$proxyAddr = (get-itemproperty 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Internet 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