title: Setting all headers when using Powershell Invoke-WebRequest
body: <p>I would like to download PDF file from online form.  I used the fiddler to find out the header and post fields.  However, I cannot get the header from Firefox to match with Powershell using Invoke-webrequest.</p>
  
  <p><strong>Original request</strong></p>
  
  <pre><code>POST http://somesight/SPLeam/EAMDisplayReportWithParamValues.asp HTTP/1.1   
  Host: someserver
  User-Agent: Mozilla/5.0 (Windows NT 6.1; rv:27.0) Gecko/20100101 Firefox/27.0    
  Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8    
  Accept-Language: en-US,en;q=0.5    
  Accept-Encoding: gzip, deflate
  Referer: http://someserver/SPLeam/EAMPickParamValues.asp?plant=01&amp;reportuser=reports&amp;reportuserpw=pw&amp;ReportName=SPLEAM%5CMNT+%2D+MM+Tracking+Rpt%2Erpt
  Cookie: ASPSESDFSDIDSSQAQBQC=APHPHMNCHIECSFSSPOIKBDCAM`    
  Connection: keep-alive    
  Content-Type: application/x-www-form-urlencoded    
  Content-Length: 132
  
  Text0=12%2F1%2F2013&amp;Text1=12%2F31%2F2013&amp;Text2=MESGI&amp;Drop2=MESCI&amp;Text3=01&amp;Text4=&amp;Drop4=&amp;Text5=R&amp;Text6=N&amp;cmdSaveParameters=Run+Report
  </code></pre>
  
  <p><strong>POWERSHELL</strong></p>
  
  <pre><code>POST http://someserver/SPLeam/EAMPickParamValues.asp?plant=01&amp;reportuser=reports&amp;reportuserpw=pw&amp;ReportName=SPLEAM%5CMNT+%2D+MM+Tracking+Rpt%2Erpt HTTP/1.1
  User-Agent: Mozilla/5.0 (Windows NT; Windows NT 6.1; en-US) WindowsPowerShell/3.0
  Content-Type: application/x-www-form-urlencoded
  Host: someserver
  Content-Length: 129
  Connection: Keep-Alive
  cmdSaveParameters=Run%2bReport&amp;Text3=01&amp;Text5=R&amp;Text1=12%252F31%252F2013&amp;Drop2=MI&amp;Text2=MI&amp;Text4=&amp;Text6=N&amp;Text0=12%252F1%252F2013
  </code></pre>
  
  <p>I run it as
  <code>$f = invoke-webrequest -uri $url -UserAgent $useragent -method Post -Body $param</code></p>
  
  <p>How can I make Powershell's request match what Firefox sent?</p>