Closed CDSFounder closed 2 months ago
I get the same for creating a new company contact.
I have found the following:
Parameters -AllowInsecureRedirect Allows redirecting from HTTPS to HTTP. By default, any request that is redirected from HTTPS to HTTP results in an error and the request is aborted to prevent unintentionally communicating in plain text over unencrypted connections. To override this behavior at your own risk, use the AllowInsecureRedirect parameter.
This parameter was added in PowerShell 7.4.
Invoke-CWMWebRequest.ps1...look around the middle (line 45 for me). Update it from:
$Result = Invoke-WebRequest @Arguments -UseBasicParsing
To the following:
$Result = Invoke-WebRequest @Arguments -UseBasicParsing -AllowInsecureRedirect
Then close and reload PowerShell and the CW module. That fixed it for me.
There was an issue with ConnectWise's proxy. Please reopen if this is still an issue.
I have installed the latest version of ConnectWiseManageAPI module in a Powershell 7.4 environment. I do not have any issues with most of the commands, however the New-CWMTicket command always generates the following error for me:
Line | 40 | … $Result = Invoke-CWMWebRequest -Arguments $WebRequestArguments | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | An error has been thrown. --> --> Cannot follow an insecure redirection by default. Reissue the command specifying the -AllowInsecureRedirect switch. at | Invoke-CWMWebRequest, C:\Users\Chris\<redacted>\Documents\PowerShell\Modules\ConnectWiseManageAPI\0.4.14.0\Private\Invoke\Invoke-CWMWebRequest.ps1: line 45 at Invoke-CWMNewMaster, C:\Users\Chris\<redacted>\Documents\PowerShell\Modules\ConnectWiseManageAPI\0.4.14.0\Private\Invoke\Invoke-CWMNewMaster.ps1: line 40 at New-CWMTicket, | C:\Users\Chris\<redacted>\Documents\PowerShell\Modules\ConnectWiseManageAPI\0.4.14.0\Public\Service\Tickets\New-CWMTicket.ps1: line 328 | at <ScriptBlock>, <No file>: line 1
I have tried: -Closing and re-opening Visual Studio -Disconnect / Reconnect CWM connection -Confirmed that several of the "GET" commands work fine.
This error occurs even when using the minimum required parameters. Example: New-CWMTicket -Summary "test" -company @{id = 19297}