title: PowerShell, Web Requests, and Proxies
body: <p>When making a simple <a href="https://stackoverflow.com/questions/340553/what-is-the-best-way-to-send-http-requests-from-windows-powershell">web request</a> is there a way to tell the PowerShell environment to just use your Internet Explorer's proxy settings?</p>
  
  <p>My proxy settings are controlled by a network policy(or script) and I don't want to have to modify ps scripts later on if I don't have to.</p>
  
  <p><strong>UPDATE:</strong>
  Great info from the participants. The final script template that I'll use for this will look something like the following:</p>
  
  <pre><code>$proxyAddr = (get-itemproperty 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Internet Settings').ProxyServer
  $proxy = new-object System.Net.WebProxy
  $proxy.Address = $proxyAddr
  $proxy.useDefaultCredentials = $true
  
  $url = "http://stackoverflow.com"
  $wc = new-object system.net.WebClient
  $wc.proxy = $proxy
  $webpage = $wc.DownloadData($url)
  $str = [System.Text.Encoding]::ASCII.GetString($webpage)
  Write-Host $str
  </code></pre>