0

I want to run curl command in PowerShell but I am facing error that I am not able to connect SSL/TLS

$loginurl= https://education.org/logon
$data= New-Object "System.collections.Generic.Dictionary[[String],[String]]"
$data.Add('username','abc')
$data.Add('password','abc')
$method=POST
$response= Invoke-RestMethod -Method $method -Uri $loginurl -Body $data

$response.RawContent

I tried writing in Shell it worked but in shell I used --insecure-sS as another switch to work. Can anyone please help how to resolve this in PowerShell and sometimes it gives me syntax error as well.

1 Answer 1

2

I think you need the -SkipCertificateCheck switch:

Invoke-RestMethod -Method $method -Uri $loginurl -Body $data -SkipCertificateCheck

Incidentally, a simpler way to create your hashtable is like this:

$data = @{'username'='abc';'password'='abc'}
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.