Sunday, September 24, 2017

Internet Explorer has to be run before Invoke-WebRequest will work

While testing a web API endpoint with PowerShell's Invoke-WebRequest, I encountered this interesting error message:

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.

Sure enough, supplying -UseBasicParsing made the request work, but the parts of the response object that required Internet Explorer components were expectedly absent. Apparently, this happens because I had never run Internet Explorer on this computer (I used Edge, not IE, once to download Chrome). Launching it, answering its question about security settings, and closing it made Invoke-WebRequest work as normal.

No comments:

Post a Comment