Starting with PowerShell 7.4, there has been a change in the behavior of the -OutFile parameter, particularly in its handling of $null values. As a result, the existing implementation of the Request may trigger an exception, preventing any requests from being sent to the Safeguard REST API.
To address this, the proposed fix involves validating whether $OutFile is set prior to passing it to the Invoke-WebRequest or Invoke-RestMethod commands.
@sthayduk Thanks for submitting a fix. We consolidated the code a little more in another PR and merged it today. It was also broken for the -InFile parameter.
Starting with PowerShell 7.4, there has been a change in the behavior of the -OutFile parameter, particularly in its handling of $null values. As a result, the existing implementation of the Request may trigger an exception, preventing any requests from being sent to the Safeguard REST API.
To address this, the proposed fix involves validating whether $OutFile is set prior to passing it to the Invoke-WebRequest or Invoke-RestMethod commands.
https://github.com/PowerShell/PowerShell/issues/20744