Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

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:

  1. Install the root certificate of the website you are trying to connect to on the machine where the PowerShell script is running.

  2. Add the website's SSL/TLS certificate to the trusted root store on the machine where the PowerShell script is running.

  3. 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.