Problem downloading from Powershell Gallery?

Just as Bentley is planning on doing shortly, the Powershell Gallery website has disabled TLS 1.0 and 1.1 security protocols. This means installing or updating modules in Powershell now require TLS 1.2. On Windows 10 this seems to be taken care of as I could update my workstation no problem.

There are 2 solutions for fixing this on other OS (we were having the problem with Server 2016). First is Paul Patterson's note here:

https://communities.bentley.com/products/projectwise/content_management/f/projectwise-powershell-extensions-forum/195495/1-21-0-0-install-issue

It shows the command line below will enable TLS 1.2 in your current Powershell session.

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

This is session specific so if you quit Powershell and re-open you'll have to run it again to fix. You can add this command line to your Powershell profile and it will automatically run every time you open Powershell.

Next fix is a permanent fix that fixes all .NET 4 and after applications. This fixed my Server 2016 issues in all sessions without having to run the command above.

  1. Close all PowerShell sessions
  2. Open RegEdit
  3. Browse to HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\.NETFramework\v4.0.30319
  4. Create a DWORD value
    1. Name: SchUseStrongCrypto
    2. Value: 1
  5. (if the value already exists and is value 0, change it to 1)
  6. Next fix for 32-bit apps as well:
  7. browse to HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\.NETFramework\v4.0.30319
  8. Create a DWORD value
    1. Name: SchUseStrongCrypto
    2. Value: 1
  9. (again, set to 1 if it already exists)

Open Powershell and downloads from PowerShell Gallery should work without issuing the command above. This fix summarized from johnlouros.com/.../enabling-strong-cryptography-for-all-dot-net-applications

Parents Reply Children
No Data