对于报告工具,我需要下载只能通过 SOCKS 代理访问的 XML。我的想法是在 IE 中安装代理但禁用它,然后在 powershell 中启用它几秒钟,以便我下载它,但这似乎不起作用。有人有其他解决方法吗?
这是我的代码
$proxyAddr = (get-itemproperty 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Internet Settings').ProxyServer
$proxy = new-object System.Net.WebProxy
$proxy.Address = $proxyAddr
$proxy.useDefaultCredentials = $true
$url = "https://appmon-apm.####.##/rest/management/dashboard/xmlgen"
$wc = new-object system.net.WebClient
$wc.proxy = $proxy
$webpage = $wc.DownloadData($url)
$str