Today I needed to make this script work behind a proxy, something that I have found in the past but was not able to find a good set of instructions.
I got it working and I wanted to share it with you, in case someone else is looking for it.
all you need to do is add the following 4 lines anytime before downloading the data (I prefer to do it right after instancing the WebClient object):
$proxyObject = new-object System.Net.WebProxy("MyProxyServer", 8080)
$proxyObject.BypassProxyOnLocal = $true
$proxyObject.Credentials = [System.Net.CredentialCache]::DefaultCredentials
[System.Net.GlobalProxySelection]::Select = $proxyObject
I hope it helps.
Best regards, Marianok.
AAD Connect Version 1.1.486.0 Released
5 days ago