title: Invoke-WebRequest Error
body: <p>Recently promoted to Systems Admin and am really just getting setup. We've got a powershell script we use to check some services. Seems to work for all the other admins. I'm thinking it is permissions at this point but wanted to check here to see if I was missing anything.</p>
  
  <p>Powershell Script</p>
  
  <pre><code>Import-Module WebAdministration -ErrorAction SilentlyContinue 
  
  
  #Change the location to match your file.
  $ServerLocation = "C:\Scripts\Servers"
  $StartTime = Get-Date
  
  
  $ServerName = Get-Content "$ServerLocation\ServerText.txt"
  
  
  ForEach ($Server in $ServerName)
  {
     #$Server = "ServerPD20" 
     #Invoke-WebRequest -Uri http://$Server/ServerService/ServerCalculator.svc | Select StatusDescription
     Write-Host $Server -ForegroundColor Cyan
     $Check = Invoke-WebRequest -Uri http://$Server/ServerService/ServerCalculator.svc
     If($Check.StatusDescription -eq 'OK')
     {
        Write-Host "Server Calculator Service is:" $Check.StatusDescription
        Write-Host "Status Code:" $Check.StatusCode
        $Time = (Measure-Command {Invoke-WebRequest -Uri http://$Server/ServerService/ServerCalculator.svc}).TotalSeconds
        Write-Host "Total Request Time: $Time seconds" `n -ForegroundColor Gray
     }
     ElseIf($Check.StatusDescription -ne 'OK')
     {
        Write-Host "Server Calculator Service is NOT ONLINE" -ForegroundColor Red
        Write-Host "Status Code:" $Check.StatusCode `n
     }
  }
  $RunTime = Get-Date
  Write-Host `n"Start Time" $StartTime
  Write-Host "Run Time: "$RunTime -ForegroundColor Yellow
  </code></pre>
  
  <p>The output I get</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:\Scripts\Folder\CalculatorCheck.ps1:17 char:13
  +    $Check = Invoke-WebRequest -Uri http://$Server/ServerCalculator ...
  +             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      + CategoryInfo          : NotImplemented: (:) [Invoke-WebRequest], NotSupportedException
      + FullyQualifiedErrorId : WebCmdletIEDomNotSupportedException,Microsoft.PowerShell.Commands.InvokeWebRequestCommand
  </code></pre>
  
  <p>Two things to note. </p>
  
  <p>I have logged onto all four boxes with the same account I am running the powershell script. I'm right clicking and run as other user. The username I enter this is what I've logged onto all 4 servers with and made sure IE has been opened.</p>
  
  <p>If I add -UseBasicParsing after "$Check = Invoke-WebRequest -Uri http://$Server/ServerService/ServerCalculator.svc" I am able to get the response I am looking for. But I still receive the error IE first launch.</p>
  
  <p>Any ideas?</p>
  
  <p>Thank you!</p>