cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
426
Views
0
Helpful
0
Replies

XMLAPI MX using CE9.3 not able to ignore self signed certificates with Powershell

John F
Level 1
Level 1

I cannot seem to get this to work using Powershell 5.1. The device is a Cisco MX800 CE9.3.

$url = "https://10.1.135.20/getxml?location=/Status"
[Net.ServicePointManager]::ServerCertificateValidationCallback={$true} 
$webclient = New-Object System.Net.Webclient
$credCache = New-Object System.Net.CredentialCache
$creds = New-Object System.Net.NetworkCredential($user,$pwd)
$credCache.Add($url, "Basic", $creds)
$webclient.Credentials = $credCache
$webpage = $webclient.DownloadString($url)

Running this script using http returns XML as expected, but using https returns the error below

Exception calling "DownloadString" with "1" argument(s): "The underlying connection was closed: An unexpected error occurred on a send." + CategoryInfo : NotSpecified: (:) [], MethodInvocationException + FullyQualifiedErrorId : WebException

0 Replies 0