Reputation: 109
I have script to GET HTTP content and I need bypass proxy (connect directly to webserver IP).
Is it possible without changing registry in Windows? This code is going through proxy defined in system.
Thanks for advice Best regards.
$url='https://10.10.10.10/check';
$webClient = new-object System.Net.WebClient;
$output = $webClient.DownloadString($url)
Upvotes: 4
Views: 10811
Reputation: 200293
According to the documentation you have to set the proxy to a blank proxy instance. Try this:
$url = "https://10.10.10.10/check"
$webClient = New-Object System.Net.WebClient
$webClient.Proxy = [System.Net.GlobalProxySelection]::GetEmptyWebProxy()
$output = $webClient.DownloadString($url)
Upvotes: 6