I’m making an automated script to read a list from a site posting the latest compiled code. That’s the part I’ve already figured out. The next part of the script is to grab that compiled code from a server with an Untrusted Cert.
This is how I’m going about grabbing the file:
$web = new-object System.Net.WebClient $web.DownloadFile('https://uri/file.msi', 'installer.msi')
Then I get the following error:
Exception calling ‘DownloadFile’ with ‘2’ argument(s): ‘The underlying connection was closed: Could not establish trust relationship for the SSL/TLS secure channel.’
I know I’m missing something, but I can’t get the correct way to search for it.
You need to write a callback handler for ServicePointManager.ServerCertificateValidationCallback.