When PowerShell fails to install a module

Just change your TLS settings

So, you try to install a module with the string

install-module -name name_of_the_module

but fails with a prompt for a NuGet provider:

You know for a fact that internet connection is not the issue…

Trying to install the NuGet module with install-module -name NuGet or with Install-PackageProvider -Name NuGet -RequiredVersion -Force fails as well.

The solution is to change the TLS settings by running this snippet in your PS window:

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

Circling back to the prerequisites of install the NuGet module should succeed now:

Install-PackageProvider -Name NuGet

And you good to go with installing the required module: install-module -name name_of_the_module