In PowerShell 2.0, I know that you can install the proxy server that you want to use without knowing the exact settings of the proxy server by doing something like the following:
$proxy = [System.Net.WebRequest]::GetSystemWebproxy()
$proxy.Credentials = [System.Net.CredentialCache]::DefaultCredentials
Now, my question is, if I do not know the proxy server settings I can use above and combine it with PowerShell 3.0 Invoke-WebRequest. Here is what I was hoping to do:
$proxy = [System.Net.WebRequest]::GetSystemWebproxy()
$proxy.Credentials = [System.Net.CredentialCache]::DefaultCredentials
$WS.Proxy = $proxy
$login = Invoke-WebRequest https:
However, when I try to do this, I get an error (apparently from my proxy server) indicating that my credentials cannot be verified. I hope this works out eventually, but maybe I'm just making a simple mistake.
Chris source
share