Snow-Shell / servicenow-powershell

PowerShell module to automate ServiceNow service and asset management. This module can be used standalone, with Azure Automation, or Docker.
Apache License 2.0
360 stars 170 forks source link

UseBasicParsing for PowerShell version 5 (RunOn = Azure) #141

Closed mojoaar closed 3 years ago

mojoaar commented 3 years ago

Hi.

Trying to do a simple Get-ServiceNow command (RunOn = Azure). When running local I have no problems (PS version 7). When running on AA I get the error: "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. "

If I look at Invoke-ServiceNowRestMethod.ps1 I see that it does not include the -UseBasicParsing parameter.

Would it be an idea to workaround this issue by checking the PS version where the code is running?

PS version: above 6 = dont use -UseBasicParsing parameter PS version: 5 and bellow = use -UseBasicParsing parameter

Did a simple (RunOn = Azure) call as a test to confirm: Invoke-WebRequest -Uri 'https://api.chucknorris.io/jokes/random' -UseBasicParsing

Any ideas, comments - am I missing something maybe?

gdbarron commented 3 years ago

Hi @mojoaar. I don't think you're missing anything. Some quick research shows this not only will solve your issue, but shouldn't harm anything else either. Also, they kept the parameter for >=v6, its been deprecated and just doesn't do anything as basic parsing is now the default. Let me do some testing with it, but I'm sure it'll be fine.

I took over the project a few months ago and was wondering if anyone was actually using the AA side of it. I now have my answer 😄