This question already has an answer here:
- Invoke-WebRequest SSL fails? 3 answers
I am using this code
$WebClient = New-Object system.net.webclient
$WebClient.credentials = New-Object System.Net.NetworkCredential -ArgumentList $username, $password
$WebClient.Proxy = $null
$WebClient.Headers.Add("COperation","MethodCall")
$WebClient.Headers.Add("CMethod", "EnumerateInstances")
$WebClient.Headers.Add("CObject", $NameSpace)
$WebClient.Headers.Add("Content-Type", "application/xml")
$System= $WebClient.UploadString($Url, "POST", $EnumMessage)
This works well. What I want to do is that set the Security Protocol to Tls1.2 or Tls1.1. Please help.