Browse Community
Help
Log In
Responses(1)
Solutions(1)
kelvinw22
1 Rookie
•
13 Posts
0
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"
Dell Support Resources
View All
Top
kelvinw22
1 Rookie
•
13 Posts
0
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"