How do you download a file from an https site that requires username and password? I tried both:
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls, [Net.SecurityProtocolType]::Tls11, [Net.SecurityProtocolType]::Tls12, [Net.SecurityProtocolType]::Ssl3
[Net.ServicePointManager]::SecurityProtocol = "Tls, Tls11, Tls12, Ssl3"
$download_url = "C:\Users\me\Downloads\Monthly Report.csv"
$local_path = "C:\Users\me\Downloads\Monthly Report.csv"
$user = "myusername"
$pass = "mypassword"
$WebClient = New-Object System.Net.WebClient
$WebClient.Credentials = New-Object System.Net.NetworkCredential($user, $pass)
$WebClient.DownloadFile($download_url, $local_path)
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls, [Net.SecurityProtocolType]::Tls11, [Net.SecurityProtocolType]::Tls12, [Net.SecurityProtocolType]::Ssl3
[Net.ServicePointManager]::SecurityProtocol = "Tls, Tls11, Tls12, Ssl3"
$download_url = "C:\Users\me\Downloads\Monthly%20Report.csv"
$local_path = "C:\Users\me\Downloads\Monthly%20Report.csv"
$user = "myusername"
$pass = "mypassword"
$WebClient = New-Object System.Net.WebClient
$WebClient.Credentials = New-Object System.Net.NetworkCredential($user, $pass)
$WebClient.DownloadFile($download_url, $local_path)
I'm getting an error: [Download File] Error: Download failed: The request was aborted: Could not create SSL/TLS secure channel.