PowerShell 4.0
Windows Server 2012 R2
Hello, I have a handshake method to GET token, like
$response = Invoke-WebRequest -Uri "https://**.**.**.**:port/token/" -Method GET -Headers @{Authorization = "Basic blahblahblah"} -Body @{grant_type="client_credentials"}
Then I have an error
Invoke-WebRequest : The request was aborted: Could not create SSL/TLS secure channel
Postman and CURL is working, does anybody knows how to disable certificate checking in POSH script ?
Following things don't help me:
using System.Net;
using System.Security.Cryptography.X509Certificates;
public class TrustAllCertsPolicy : ICertificatePolicy {
public bool CheckValidationResult(
ServicePoint srvPoint, X509Certificate certificate,
WebRequest request, int certificateProblem) {
return true;
}
}
"@
$AllProtocols = [System.Net.SecurityProtocolType]'Ssl3,Tls,Tls11,Tls12'
[System.Net.ServicePointManager]::SecurityProtocol = $AllProtocols
[System.Net.ServicePointManager]::CertificatePolicy = New-Object TrustAllCertsPolicy