Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Server Core - UseBasicParsing on Invoke-WebRequest/RESTRequest #5

Closed
JaibeHyne opened this issue Sep 20, 2023 · 3 comments
Closed

Server Core - UseBasicParsing on Invoke-WebRequest/RESTRequest #5

JaibeHyne opened this issue Sep 20, 2023 · 3 comments
Assignees
Labels
enhancement New feature or request

Comments

@JaibeHyne
Copy link

When using Server Core with FreshservicePS we can't issue any commands without trigging the exception.
For server core doesn't have Internet Explorer Invoke-WebRequest or Invoke-RestMethod require the parameter -UseBasicParsing

Current Behavior

Any issued FreshservicePS cmdlet on Server Core hits error exception. Exception message:
"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:\Program Files\WindowsPowerShell\Modules\FreshservicePS\0.1.3\Private\Invoke-FreshworksRestMethod.ps1"

Possible Solution

Add optional parameter switch for UseBasicParsing on FreshservicePS cmdlets or alternatively check if running Server Core before issuing command and adjust parameters used in Invoke-FreshworksRestMethod.ps1 module.

Context

We run a lot of Azure Automation from Server Core servers and want to use FreshservicePS on existing servers.

Your Environment

  • Module version used: 0.1.3
  • Operating System and PowerShell version: Server Core, PowerShell v5.1
@rasimmers rasimmers self-assigned this Oct 2, 2023
@rasimmers rasimmers added the enhancement New feature or request label Oct 2, 2023
@rasimmers
Copy link
Contributor

Hi @JaibeHyne. Can you provide the version of Powershell being run on those servers? Based on the docs, it appears that this parameter is deprecated in version 6 or higher and is the default.

-UseBasicParsing
This parameter has been deprecated. Beginning with PowerShell 6.0.0, all Web requests use basic parsing only. This parameter is included for backwards compatibility only and any use of it has no effect on the operation of the cmdlet.

Not sure if the best route is detection of a PS version or if a option is provided in the New-FSConnection\Set-FSConnection to append the switch at runtime if $true. If it's detection, what is the criteria for forcing this option?

@rasimmers
Copy link
Contributor

After reviewing some other modules, it looks like it has been hardcoded to support backwards compatibility. The Invoke-WebRequest will have the appended for all calls in Invoke-FreshworksRestMethod.

@rasimmers
Copy link
Contributor

@JaibeHyne FreshservicePS 0.1.4 has been published and released with the update to -UseBasicParsing requested.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants