我正在尝试通过 PowerShell 在我的 Windows Server 2016 上安装 Az 模块,但它给了我下面屏幕截图中显示的错误。
在 Windows 10 服务器上尝试时也会出现相同的错误。
如果我尝试安装 Azure RM 命令仍然是同样的错误。
我在 Windows 2016 服务器上安装了 .Net Framework 4.8,在 Windows 10 服务器上安装了 .Net 4.7。 两台服务器的PS版本都是5.1。
我尝试参考多个网站上提到的几个解决方案,但似乎没有一个可行。
谁能告诉我我遗漏了什么或者我该如何解决这个错误?
答案 0 :(得分:0)
我过去常常遇到这些错误。
尝试运行:
Find-Module PowerShellGet | Install-module
如果不是这样应该可以:
[Net.ServicePointManager]::SecurityProtocol = [Net.ServicePointManager]::SecurityProtocol -bor [Net.SecurityProtocolType]::Tls12
Register-PSRepository -Default -Verbose
Set-PSRepository -Name "PSGallery" -InstallationPolicy Trusted
然后你应该可以安装模块了。