There are a few ways to resolve the issue of lacking trust relationship for the SSL/TLS secure channel while using Invoke-WebRequest in PowerShell:
Install the root certificate of the website you are trying to connect to on the machine where the PowerShell script is running.
Add the website's SSL/TLS certificate to the trusted root store on the machine where the PowerShell script is running.
Disable certificate validation checks by adding the following line of code at the beginning of the PowerShell script:
[System.Net.ServicePointManager]::ServerCertificateValidationCallback = {$true}
However, it is important to note that disabling certificate validation checks can leave your connection vulnerable to attacks, and should be used only as a temporary solution if no other options are available. It is recommended to use one of the first two options to properly establish a trusted SSL/TLS secure channel.
Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss
Asked: 2021-09-15 11:00:00 +0000
Seen: 11 times
Last updated: Jul 18 '21
How do I resolve a 502 error when attempting to call an HTTPS REST API from an HTTP REST API?
I keep receiving a 404 error while running the application on AWS EC2, can you help me with that?
In a Bootstrap 5.1 Modal popup, why is the property 'classList' unable to be read for undefined?
How can the issue of an image not being shown in ASP.NET MVC be resolved?
Although values are present in GTM, why are some DataLayer parameter values absent in GA4?