convert command from curl to powershell RRS feed

  • Question

  • I want to convert the below curl command to powershell

    curl https://someurl.com --cacert ca.pem --cert pub.pem --key priv.pem -vvvv

    I've worked out most of the command I need to use please see below

    $cert = Get-ChildItem Cert:\LocalMachine\my | Where-Object {$_.DnsNameList -like 'somedomain.com'}

    $url = 'https://somedomain.com'

    [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityProtocolType]::Tls12; 

    Invoke-WebRequest -Uri $url -Certificate $cert -Verbose

    However I received the below error message when I ran the script

    Invoke-WebRequest : The request was aborted: Could not create SSL/TLS secure channel.

    any help would be great cheers

    • Edited by Brett Wright Monday, July 31, 2017 12:19 AM
    • Moved by Bill_Stewart Friday, December 29, 2017 8:57 PM Abandoned
    Monday, July 31, 2017 12:17 AM

All replies

  • Hi have a look at https://stackoverflow.com/questions/41618766/powershell-invoke-webrequest-fails-with-ssl-tls-secure-channel

    It maybe using the wrong TLS version 

    Monday, July 31, 2017 9:21 AM