title: Error when using DownloadString from a website using powershell
body: <p>When executing the code below to get a value for a web server I get this error.</p>
  
  <p>I have read some possible solutions that involve changing setting on the web server it’s self but this is not an option for me because I don’t own the server.</p>
  
  <p><strong>Error</strong></p>
  
  <blockquote>
    <p>Exception calling "DownloadString" with "1" argument(s): "The server
    committed a protocol violation. Section=ResponseStatusLine" At
    C:\get.ps1:28 char:60
    + $ramPage = (New-Object System.Net.WebClient).DownloadString &lt;&lt;&lt;&lt; ("http://" + $server + "/RAM/" + $evalRAMStars)
        + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
        + FullyQualifiedErrorId : DotNetMethodException</p>
  </blockquote>
  
  <p><strong>Powershell Code</strong> </p>
  
  <pre><code>Function Get-Performance(){
  $CPU = Get-WmiObject win32_processor | Measure-Object -property LoadPercentage -Average | Select Average
  
  $SystemInfo = Get-WmiObject -Class Win32_OperatingSystem | Select-Object Name, TotalVisibleMemorySize, FreePhysicalMemory
  $perRam = (($SystemInfo.FreePhysicalMemory/1MB) / ($systeminfo.totalvisiblememorysize/1MB)) * 100
  $perRam = 100 - $perRam
  
  Write-host ("CPU:  " + $CPU.Average + "%")
  Write-host ("Ram:  " + $perRam + "%")
  
  $CPUStars = $CPU.Average / 10
  $RAMStars = $perRam /10
  
  if($CPUStars -lt 1){$CPUStars = 1}
  
  Write-host ("{0:N0}" -f $CPUStars)
  Write-host ("{0:N0}" -f $RAMStars)
  
  $evalCPUStars = "{0:N0}" -f $CPUStars
  $evalRAMStars = "{0:N0}" -f $RAMStars
  
  $server = "10.0.0.188"
  
  #this will get our page for later
  $cpuPage = (New-Object System.Net.WebClient).DownloadString("http://" + $server + "/CPU/" + $evalCPUStars)
  $ramPage = (New-Object System.Net.WebClient).DownloadString("http://" + $server + "/RAM/" + $evalRAMStars)
  Write-host("http://" + $server + "/CPU/" + $evalCPUStars)
  Write-host("http://" + $server + "/RAM/" + $evalRAMStars)
  }
  
  While($x -ne 0)
  {
      Get-Performance
      Start-Sleep -s 10   #this will run the powershell script every 10 seconds.
  }
  </code></pre>