I'm trying to download XML file (Jenkins config.xml history file) from Jenkins HTTPS server. I searched here and elsewhere but still cannot find the way to get it working.
$url = "https://<server-path>/configOutput?type=xml×tamp=2018-02-23_13-09-02"
$file = "d:\file.xml"
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Ssl3
$wc = New-Object System.Net.WebClient
$wc.Credentials = Get-Credential
$wc.DownloadFile($url, $file)
After supplying credentials to prompt I'm getting this error:
Exception calling "DownloadFile" with "2" argument(s): "The underlying connection was closed: An unexpected error occurred on a receive." At D:\ps\jenkins-config\get_xml.ps1:7 char:1 + $wc.DownloadFile($url,$file) + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : NotSpecified: (:) [], MethodInvocationException + FullyQualifiedErrorId : WebException