title: PowerShell, Test if Internet Explorer has initialised
body: <p>A recurring problem that I have on every new system is that my PowerShell scripts will break on running <code>Invoke-WebRequest</code> due to the incredibly frustrating requirement that this Cmdlet cannot run until Internet Explorer has initialised. I would appreciate how we should script around and understand the following points:</p>
  <ul>
  <li><p>How to test (in PowerShell) if Internet Explorer has been initialised?, and</p>
  </li>
  <li><p>A clean and simple and <em>silent</em> way to initialise Internet Explorer in the background so that my scripts don't break and can continue to run?</p>
  </li>
  <li><p>Also, I'm utterly confused on this one: Why are we still beholden (in 2020!) to the ancient, insecure and essentially useless application that is Internet Explorer?</p>
  </li>
  </ul>
  <p>The problem manifests itself with the following error if <code>Invoke-WebRequest</code> is run when IE has not been run:</p>
  <pre><code>Invoke-WebRequest : The response content cannot be parsed because the Internet Explorer engine is not available, or Internet Explorer's first-launch
  configuration is not complete. Specify the UseBasicParsing parameter and try again.
  At C:\Users\Boss\Documents\WindowsPowerShell\Modules\Custom-Tools\Custom-Tools.psm1:8677 char:13
  +     $page = Invoke-WebRequest -uri $url
  +             ~~~~~~~~~~~~~~~~~~~~~~~~~~~
      + CategoryInfo          : NotImplemented: (:) [Invoke-WebRequest], NotSupportedException
      + FullyQualifiedErrorId : WebCmdletIEDomNotSupportedException,Microsoft.PowerShell.Commands.InvokeWebRequestCommand
  </code></pre>