...
Code Block |
---|
$host.version |
...
Code Block |
---|
### Load the Certificate x509
$CertPathDer = "C:\Users\plessisa\Desktop\Rest\Cert.der"
$certDer = New-Object System.Security.Cryptography.X509Certificates.X509Certificate2($CertPath)
### Login
$BodyValue = "Username=restuser&Password=restpass"
$url = "https://134.56.226.215/rest/login"
Invoke-RestMethod -Uri $url -Certificate $certDer -Method Post -Body $BodyValue -SessionVariable ps |
Code Block |
---|
### Allow self Sign Cert add-type @" using System.Net; using System.Security.Cryptography.X509Certificates; public class IDontCarePolicy : ICertificatePolicy { public IDontCarePolicy() {} public bool CheckValidationResult( ServicePoint sPoint, X509Certificate cert, WebRequest wRequest, int certProb) { return true; } } "@ [System.Net.ServicePointManager]::CertificatePolicy = new-object IDontCarePolicy ### Login $BodyValue = "Username=restuser&Password=restpass" $url = "https://134.56.226.215/rest/login" Invoke-RestMethod -Uri $url -Method Post -Body $BodyValue -SessionVariable ps |
...