Repairing PowerShell Gallery Access

by Nov 16, 2020

The PowerShell Gallery (www.powershellgallery.com) is a perfect place to look for new PowerShell commands. With Install-Module, you can easily download and install new PowerShell modules.

However, sometimes things fail, and there are two primary reasons why.

Occasionally, the original PowerShellGet module shipping with Windows 10 is outdated. You then get exceptions complaining about missing or wrong parameters.

To solve this, you need to manually update PowerShellGet. Run the following line with Administrator privileges:

Install-Module -Name PowerShellGet -Repository PSGallery -Force

The second common reason: your Windows version does not support the TLS1.2 protocol. In this case you get connection problems. Try and run this:

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

This setting applies to the current PowerShell session. If you want to keep this setting, place the line into your profile script. The path can be found in $profile.


Twitter This Tip! ReTweet this Tip!