title: How to automatically login to Chrome using PowerShell. I have a script that runs using IE but need to use Chrome
body: <p>#Set URL.</p>
  <pre><code>$Url = &quot;https://www.plexonline.com&quot;; 
  $Username=&quot;xxxx&quot;;
  $Password=&quot;xxxx&quot;;
  $CompanyCode=&quot;xxx&quot;;
  </code></pre>
  <h1>Create a new COM object for IE.</h1>
  <pre><code>$IE = New-Object -ComObject internetexplorer.application;
  </code></pre>
  <h1>Set IE to FullScreen.</h1>
  <pre><code>$IE.FullScreen = $true;
  </code></pre>
  <h1>Set IE to visible.</h1>
  <pre><code>$IE.Visible = $true;
  </code></pre>
  <h1>Navigate IE to the specified URL.</h1>
  <pre><code>$IE.navigate($url); 
  </code></pre>
  <h1>Wait until IE is not longer busy.</h1>
  <pre><code> while ($IE.Busy -eq $true) 
      { 
          Start-Sleep -Milliseconds 500; 
      } 
  </code></pre>
  <h1>Insert the specified username, password, and company code in to their respective fields.</h1>
  <pre><code>$IE.Document.getElementById(&quot;txtUserID&quot;).value = $Username;
  $IE.Document.getElementByID(&quot;txtPassword&quot;).value = $Password;
  $IE.Document.getElementByID(&quot;txtCompanyCode&quot;).value = $CompanyCode;
  </code></pre>
  <h1>Start the login process.</h1>
  <pre><code>$IE.Document.getElementById(&quot;btnLogin_Label&quot;).Click();
  </code></pre>
  <h1>Continue to wait until IE is no longer busy.</h1>
  <pre><code>while ($IE.Busy -eq $true) 
  { 
  Start-Sleep -Milliseconds 2000; 
  }   
  </code></pre>