If you are trying to download a module from the PowerShell gallery and seeing a message like
UNABLE TO DOWNLOAD FROM URI: HTTPS://GO.MICROSOFT.COM/FWLINK…
You are likely working on an older operating system with old cryptography. Fortunately, this is very easy to fix:
- Launch a new PowerShell as an Administrator
- Check the cryrptography your OS supports using this command:
[Net.ServicePointManager]::SecurityProtocol
It probably shows SSL3, TLS like you can see in the screenshot above both of which are deprecated. You need TLS 1.2 - To add TLS 1.2 run these two commands:
Set-ItemProperty -Path 'HKLM:\SOFTWARE\Wow6432Node\Microsoft\.NetFramework\v4.0.30319' -Name 'SchUseStrongCrypto' -Value '1' -Type DWord
Set-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\.NetFramework\v4.0.30319' -Name 'SchUseStrongCrypto' -Value '1' -Type DWord
. - Open a new PowerShell as an Administrator
- Check the cryrptography again using this command:
[Net.ServicePointManager]::SecurityProtocol
and you should see:
TLS, TLS11, TLS12 - Install NuGet using this command:
Install-Module PowershellGet -Force -SkipPublisherCheck
- Have a nice cold beer and calm down 🙂
2 Comments
Yvet · July 3, 2024 at 11:44 am
This is my first time visit and i am super happy to read everthing about powershell at single place.
SOLVED: Command Line To Uninstall, Reinstall, Repair .NET Framework – Up & Running Technologies, Tech How To's · October 18, 2022 at 9:00 pm
[…] a PowerShell as an Admin and run each of these commands one by one adjusting the D:SOURCES path to whatever […]