Unable to Resolve Package Source
I can’t seem to update any PowerShell module anymore
Today I ran into a problem on my Hyper-V test lab system
Whenever I ran Install-Module
or Update-Module
on my system, I’d get the error message:
|
|
Now I received this error message, but surely I’m not alone in this, chances are you’re here because you experienced the same problem!
This can be a real pain in the ass, because chances are you just wanted to install/update one issue and now you’re stuck with a completely different issue eating up your time.
How to fix this problem
DNS
When trying to troubleshoot the issue, you can first try and see if there’s an issue with DNS or your connection:
|
|
Connection
If that looks fine, trying to establish a connection to the site can be your next step:
|
|
This gave me the error
|
|
Based on this Could not establish trust relationship for the SSL/TLS secure channel.
it looks like this may be a TLS issue and
You can first try and force your system to talk over TLS1.2 using the following command:
|
|
PowerShellGet
But if that doesn’t work you may need to upgrade to the latest PowerShellGet (2.2.5), which handles temporary compatibility with TLS 1.2 on legacy TLS systems:
|
|
But here lies another issue… you can’t install/update a module if you can’t install a module…
So what you can do is download it on another machine that DOES have the proper connection/configuration, save it and copy it to your ‘broken’ system:
On your working machine:
|
|
Confirm that these are the versions you want (at time of writing PowerShellGet is at version 2.2.5
and PackageManagement is at version 1.4.7
).
Save them to a temporary folder (in this example C:\temp
, change this accordingly):
|
|
Only Saving PowerShellGet automatically takes along the PackageManagement module due to its dependency.
Now copy the modules from your working machine to your broken machine, be sure to place the module files under
C:\Program Files\WindowsPowerShell\Modules\
and be sure to merge the folders with currently existing ones.
In order for the new modules to be used instead of the old version, you’re best off to close and re-open a new PowerShell session.