2017-01-16 2 views
1

ich diesen Code verwendenPowershell Einstellung Sicherheitsprotokoll TLS 1.2

 $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) 

Diese gut funktioniert. Ich möchte das Sicherheitsprotokoll auf Tls1.2 oder Tls1.1 setzen. Bitte helfen Sie.

Antwort

3

Einstellung sollte das Protokoll ändern:

[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityProtocolType]::Tls12; 

PS: geprüft in Power v5

Einstellung Mehrere Sicherheitsprotokolle:

[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityProtocolType]::Tls11 -bor [System.Net.SecurityProtocolType]::Tls12; 
+1

, wie das setzen entweder Tls11 oder Tls12 zu benutzen? – user2940249