PowerShell is continuing to evolve.  Occasionally I come across a server that I need to install modules to and find that I cannot.  Windows Management Framework 5.1 is installed to Server 2016/2019 out of the box but it’s not directly equipped to be caught up – you need to do some steps first.

  1. Open PowerShell (as Administrator is also an option)
  2. Copy/Paste:   Set-ExecutionPolicy Unrestricted
    1. Execute
  3. Copy/Paste:  [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
    1. Execute
  4. Copy/Paste:  Register-PSRepository -Default
    1. Execute
  5. Copy/Paste:  Update-Module PowerShellGet -Force
    1. Execute

At this point you should be in good shape to add whatever modules it is you are trying to install from the repository. 

  • Install-Module AzureAD
  • Install-Module ExchangeOnlineManagement
  • etc