I've run into problems with Windows Server where the Install-Module cmdlet generate errors and won't download from the PowerShell repository on the internet. To fix this you need to enable TLS 1.2 for PowerShell.
To do this permanently for .NET 4 and up, set two registry keys for 64-bit and 32-bit .NET Framework:
Set-ItemProperty -Path 'HKLM:\SOFTWARE\Wow6432Node\Microsoft\.NetFramework\v4.0.30319' -Name 'SchUseStrongCrypto' -Value '1' -Type DWord
Set-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\.NetFramework\v4.0.30319' -Name 'SchUseStrongCrypto' -Value '1' -Type DWord
If you need to do a quick temporary fix because you can't update the registry then use this:
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
The temporary fix is only for the current PowerShell prompt.
0 Comments