Search code examples
httpsssl-certificatemicrosoft-bits

Powershell BitsTransfer (https) with invalid certificate authority


I'm trying to automate the weekly download of a text file from an https site with a ps1 script. My simple attempts to connect look like this -

Start-BitsTransfer `
-source https://url.com/file `
-destination d:\test.txt

I get the error "The certificate authority is invalid or incorrect". Is there a way to override this CA check?

This Powershell (3.0) script is running on Windows Server 2008R2 and the https://url.com/ SSL cert is issued by Entrust CA. I've tried to add Entrust as a "Trusted Root Certificate Authority" to the "Certificate Store" through IE8. No joy.


Solution

  • This really racked my brain for quite some time. I finally figured out you need to enter the number in decimal not in binary or hex.

    C:>bitsadmin /SetSecurityFlags myJob 8

    The 8 will make the "Ignore invalid certificate authority in server certificate :true"