1

I am trying to solve the following issue:

Exception setting "SecurityProtocol": "Cannot convert value "tls13, tls12, tls11, tls" to type "System.Net.SecurityProtocolType" due to invalid enumeration values. Specify one of the following enumeration values and try again. The possible enumeration values are "Ssl3, Tls"."

Here is my system info (windows 7/64bits):

enter image description here

Powershell version is:

PS > $PSVersionTable

Name                           Value
----                           -----
CLRVersion                     2.0.50727.8789
BuildVersion                   6.1.7601.17514
PSVersion                      2.0
WSManStackVersion              2.0
PSCompatibleVersions           {1.0, 2.0}
SerializationVersion           1.1.0.1
PSRemotingProtocolVersion      2.1

I did follow instructions from here. This is equivalent to:

# set strong cryptography on 64 bit .Net Framework (version 4 and above)
Set-ItemProperty -Path 'HKLM:\SOFTWARE\Wow6432Node\Microsoft\.NetFramework\v4.0.30319' -Name 'SchUseStrongCrypto' -Value '1' -Type DWord

And I could verify that I have:

HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft.NETFramework\v4.0.30319

However it stills fails for me (using a newly created powershell window):

PS > [enum]::GetNames([Net.SecurityProtocolType])
Ssl3
Tls

For reference:

enter image description here

malat
  • 12,152
  • 13
  • 89
  • 158
  • 2
    what version of powershell are you using? ///// also, PLEASE ... DO NOT post pictures of code, errors, or sample data. why would anyone want to help you when you force them to squint/zoom in to read the text _that you already have as text?_. ///// why force your would-be helpers to type in your code _that you already have type in_ just to test your code? – Lee_Dailey Jun 03 '19 at 09:59
  • 5
    The new `SecurityProtocolType` values only exist in .NET 4.5 and up; you're apparently still on .NET 4.0. This is irrespective of whether the OS supports the newer TLS. See also [here](https://stackoverflow.com/q/33761919/4137916). – Jeroen Mostert Jun 03 '19 at 10:00
  • 1
    Note that no configuration setting whatsoever will change the tags present in the enum, as this is strictly dependent on the loaded .NET framework. PowerShell 2.0 can be [coerced](https://stackoverflow.com/a/31279372/4137916) to use a more recent version of .NET, though a more suitable solution is to just [upgrade it](https://www.microsoft.com/en-us/download/details.aspx?id=54616). See also the previous question I linked for answers on how to use the enum value even if your version of .NET doesn't support it; you can cast the numeric value, since it's passed directly down to the Schannel API. – Jeroen Mostert Jun 03 '19 at 10:18

0 Answers0