1 Rookie

 • 

13 Posts

January 3rd, 2019 18:00

Looks like I answered my own question. Using this method works.

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

$h = "https://visioncore:8443"

$usr = "admin"

$pwd ="password"

$request = $h + "/fm/systems"

$response = Invoke-WebRequest -Uri $main -Method Get -SessionVariable cas

$form = $response.Forms[0]

$form.fields.username = $usr

$form.fields.password = $pwd

$loginurl = $h + $form.action

$response = Invoke-WebRequest -Uri $loginurl -WebSession $cas -Body $form.fields -Method Post

$response = Invoke-RestMethod -Uri $request -WebSession $cas -method get  -ContentType "application/xml"

No Events found!

Top