I’m having a hard time modifying PsGet to work though a proxy. I replaced every $client initialization on PsGet.psm1 with this
# $client = (new-object Net.WebClient)
$proxyAddr = (get-itemproperty 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Internet Settings').ProxyServer
$proxy = new-object System.Net.WebProxy
$proxy.Address = $proxyAddr
$proxy.useDefaultCredentials = $true
$client = new-object system.net.WebClient
$client.proxy = $proxy
but I still keep getting the DotNetMethodException during the WebClient request.
Give this a try. Use
[System.Net.WebRequest]::DefaultWebProxyinstead of the registry read.