WebRequest wasn´t possible

I tried to call a website with the following command:

try {
$Resp = Invoke-WebRequest “http://kenaflow/rer/test
} catch {
Write-KFLog $_.Exception.Message
}

but the request failed with the following error message in the kenaflow log after encapsulationg with try catch:

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.
kenaflow_webrequest_error

But if I run the code with other credentials during debugging I get the StatusCode 200 like exspected.

Hi hennott,

probably you run kenaflow under a service account. Right?
After a Windows update, and especially after a major update such as “Creators Update”, certain Internet Explorer settings are resetted. This will display a dialog the first time you start IE asking you to accept the “recommanded settings”.

This window prevents Invoke-WebRequest from running.

Here’s what you need to do:

  1. Log in with the function user at the machine on which kenaflow is running.
  2. Start Internet Explorer once.
  3. Change the settings in the Dialog
  4. After that you log out again.

Invoke-WebRequest should then run.

BTW: This problem does not only exist in kenaflow, but in any PowerShell script that runs under a different user account.

Thank you for using kenaflow!

Ingo

Hi Ingo,

this was exactly the reason and the solution works fine.

Thank you for your support.