title: Login into a Website via PowerShell
body: <p>I am trying to login into a website via powershell ISE. The Web page comes up but it doesn't enter the credentials.</p>
  
  <pre><code> $username = "DSmith" 
   $password = "Password123" 
  
   $ie = New-Object -com InternetExplorer.Application 
  
   $ie.visible=$false
  
   $ie.navigate("https://feedback.camdenccg.nhs.uk/acl_users/credentials_cookie_auth/require_login?    came_from=https%3A//feedback.camdenccg.nhs.uk/james-wigg-and-queens-crescent-practices/4ef32a4e/download_responses%3Foverride-query%3DTrue") 
  
  while($ie.ReadyState -ne 4) {start-sleep -m 100} 
  
  $ie.document.getElementById('__ac_name').value= "$username" 
  
  $ie.document.getElementById('__ac_password').value = "$password" 
  
  $ie.document.getElementById("loginform").submit()
  
  start-sleep 5 
  </code></pre>
  
  <p>The Error I get is:</p>
  
  <pre><code>   The object invoked has disconnected from its clients. (Exception from HRESULT: 0x80010108 (RPC_E_DISCONNECTED))
     At line:10 char:7
     + while($ie.ReadyState -ne 4) {start-sleep -m 100}
     +       ~~~~~~~~~~~~~~~~~~~~
     + CategoryInfo          : OperationStopped: (:) [], COMException
     + FullyQualifiedErrorId : System.Runtime.InteropServices.COMException
  
     You cannot call a method on a null-valued expression.
     At line:12 char:1
     + $ie.document.getElementById('__ac_name').value= "$username"
     + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
     + FullyQualifiedErrorId : InvokeMethodOnNull
  </code></pre>