When attempting to install a PowerShell module I was getting following message. In my case this was happening when attempting to install the “sqlserver” module on a Windows 2016 server.
“WARNING: Unable to resolve package source ‘https://www.powershellgallery.com/api/v2’
The issue was to do with the TLS version. I had to force the client to use TLS 1.2 using the below command.
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
This will change the current PowerShell season to use v1.2. It doesn’t make any permanent changes. Future sessions will continue to use the SystemDefault setting