title: powershell Invoke-WebRequest WebSession not working
body: <p>I can't get the following code to work. It appears to log in but then returns the login page with $response. I am guessing it has something to do with the postbacks?  Any way to get around that?  Thanks!</p>
  
  <pre><code>$login = Invoke-WebRequest -Uri 'http://www.sqlpass.org/UserLogin.aspx' -SessionVariable sqlpass
  $login.Forms[0].Fields["txtUsername_14615"] = 'myuser'
  $login.Forms[0].Fields["txtPassword_14615"] = 'mypass'
  $response = Invoke-WebRequest -Uri 'http://www.sqlpass.org/UserLogin.aspx' -WebSession $sqlpass -Method POST -Body $login
  </code></pre>