I have been able to get a basic request to work with this, using the following commands:
add-type @"
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;
}
}
"@
[System.Net.ServicePointManager]::CertificatePolicy = New-Object TrustAllCertsPolicy
$webClient = New-Object System.Net.WebClient
$webClient.Credentials = New-Object System.Net.NetworkCredential("Admin","")
$results = $webClient.DownloadString($realquery)
$res = $results | ConvertFrom-Json | select -ExpandProperty results
The problem I am having is with the credentials/authentication. I am only able to connect with a local Orion account, not with an Active Directory account that has the same rights. Is there a setting somewhere that needs to be changed to allow Active Directory accounts to authenticate with the REST API?