title: Powershell unable to connect to internet at all
body: <p>I have looked everywhere for an answer to this, but I'm thinking maybe my Google ninja skills are lacking.</p>
  
  <p>I am trying to run a simple command in Powershell that downloads a string (in reality, I want to download an msi and run it - but I've narrowed down the problem to a simple example). The script I am running is:</p>
  
  <pre><code>$client = New-Object System.Net.WebClient
  $client.DownloadString("http://google.com") | Out-File google.html
  </code></pre>
  
  <p>The error I get is:</p>
  
  <pre><code>Exception calling "DownloadString" with "1" argument(s): "Unable to connect to the remote server"
  At line:1 char:1
  + $client.DownloadString("http://google.com") | Out-File google.html
  + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
      + FullyQualifiedErrorId : WebException
  </code></pre>
  
  <p><strong>PSVersion = 4.0</strong></p>
  
  <p>I have ran this script on a colleague's PC (<strong>PSVersion = 3.0</strong>) and it works perfectly. So I know the code works. I have also re-created this code in a C# Console Application, which looks like:</p>
  
  <pre><code>static void Main(string[] args)
  {
      using(var client = new System.Net.WebClient())
      {
          var content = client.DownloadString("http://google.com");
          File.WriteAllText("D:\\google.html", content);
      }
  }
  </code></pre>
  
  <p>And that works on my machine - so I know it's not the .NET Framework that's the problem. And weirdly, I can make a call to that <code>exe</code> from Powershell and it works.</p>
  
  <p>I have narrowed it down to being a problem with Powershell, but I cannot for the life of me work out what. I have obviously done something to my machine in order break Powershell's connection to the internet, but could do with someone who knows more than me about what happens behind the scenes.</p>
  
  <p><strong>Please note</strong> This has nothing to do with PS Remoting. I don't think, but I'm not trying to use PS Remoting. I don't think...</p>