When i was installing new modules and updating existing modules i got this error / warning:
WARNING: Unable to resolve package source ‘https://www.powershellgallery.com/api/v2’.
and was looking for an answer to fix this. The problem was on the Windows Server 2016. I did not have the problem on my workstation at home. I found this thread on Stackoverflow i tried several things but it did not work for me.
This sollution is named on several sites but also did not work for me either.
( [ ] is looking like [ below in code block)
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
Underneath is the answer for me to solve this problem. I was behind a proxy and powershell update-module does not like this.
$webclient=New-Object System.Net.WebClient
$webclient.Proxy.Credentials = [System.Net.CredentialCache]::DefaultNetworkCredentials