对于报表工具,我需要下载只能通过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