Running Curl Commands for certs


I have 2 curl commands I am supposed to run for certificate validation and signing:

curl -k -u $USER -w “\n%{http_code}\n” -H “Accept: json”

curl -k --negotiate -u : -X PUT -H “Content-Type: text/json” --data ‘{“desired_state”:“signed”}’

This is way out of my league really… I’ve been trying to use Invoke-RestMethod but I am get some trust errors and connections closed errors. Has anyone worked with this before, and would you please help? I am talking to a Linux host from a Windows 2008 server…


Invoke-WebRequest (and Invoke-RestMethod) isn’t exactly a one-for-one replacement for curl.

That said, you need to look at some web access basics. Say SERVER1 is sending the request, and SERVER2 is the web server. Because you’re using HTTPS, SERVER2 is going to be expected to present an SSL certificate. Does SERVER1 trust the CA that issued the certificate? If not, it won’t work - and that sounds like your problem. I don’t think Invoke-RestMethod has an override to let you connect to an untrusted server - you’re going to have to install the appropriate trust on SERVER1 so that it trust’s SERVER2’s certificate.

SSL is pointless if the client machine (SERVER1) doesn’t trust the certificate. If you can’t use HTTP (take SSL out of it), then you need to get that trust in place.

I suppose you could consider downloading curl for Windows. Specifically, there’s an MSI installer at, allegedly.