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.
- Open PowerShell (as Administrator is also an option)
- Copy/Paste: Set-ExecutionPolicy Unrestricted
- Execute
- Copy/Paste: [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
- Execute
- Copy/Paste: Register-PSRepository -Default
- Execute
- Copy/Paste: Update-Module PowerShellGet -Force
- 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