When trying to download Powershell modules on Server 2016/2019, you may come up against the following error message;

This is linked to the insecure security protocols being used by powershell and it will need to be set to a supported protocol, this could be either if you were behind a proxy configured a certain way or the site you are connecting to only supports certain protocols.

For example, if you were trying to install the AzureAD module and it returns the following error

You can check what current security protocols you are running by the following command;


If you see SSL3, TLS as below it means its only setup for SSLv3 and TLS1.0 both now classed as insecure.

To change this to use TLS 1.2 run the following command then try your original command again

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

If that fails, it could be that a web proxy is in the way and the protocol needs to be specified in the WebClient,

$webclient=New-Object System.Net.WebClient
$webclient.Proxy.Credentials = [System.Net.CredentialCache]::DefaultNetworkCredentials
[Net.ServicePointManager]::SecurityProtocol = "tls12"

Hopefully one of these 2 commands has fixed the issue and you should now be able to download your original file.

Please be aware these are both powershell session only commands and will be lost once the powershell window is closed.

If you need this as part of a script add the line at the top.