无法以管理员身份在新安装的 Windows Server 2016 上安装 NuGet?

问题描述 投票:0回答:2

我使用的是 Windows Server 2016 和 ADFS 4.0。

作为 AD 联合服务故障排除的一部分,这需要我按照 https://adfshelp.microsoft.com/diagnosticsanalyzer/Analyze

安装 NuGet 和模块

这是我执行的操作和错误:

Install-Module -Name ADFSToolbox -Force
Import-Module -Name ADFSToolbox -Force
Install-PackageProvider -name NuGet -MinimumVersion 2.8.5.201 -Force

错误:

WARNING: Unable to download from URI 'https://go.microsoft.com/fwlink/?LinkID=627338&clcid=0x409' to ''.
WARNING: Unable to download the list of available providers. Check your internet connection.
PackageManagement\Install-PackageProvider : No match was found for the specified search criteria for the provider 'NuGet'. The package provider requires 'PackageManagement' and 'Provider' tags. Please check if the specified package has the tags.
PackageManagement\Import-PackageProvider : No match was found for the specified search criteria and provider name 'NuGet'. Try 'Get-PackageProvider -ListAvailable' to see if the provider exists on the system.

WARNING: Unable to download from URI 'https://go.microsoft.com/fwlink/?LinkID=627338&clcid=0x409' to ''.
WARNING: Unable to download the list of available providers. Check your internet connection.
PackageManagement\Get-PackageProvider : Unable to find package provider 'NuGet'. It may not be imported yet. Try 'Get-PackageProvider -ListAvailable'.

Install-Module : NuGet provider is required to interact with NuGet-based repositories. Please ensure that '2.8.5.201' or newer version of NuGet provider is installed.
Import-Module : The specified module 'ADFSToolbox' was not loaded because no valid module file was found in any module directory.

WARNING: Unable to download from URI 'https://go.microsoft.com/fwlink/?LinkID=627338&clcid=0x409' to ''.
WARNING: Unable to download the list of available providers. Check your internet connection.
Install-PackageProvider : No match was found for the specified search criteria for the provider 'NuGet'. The package provider requires 'PackageManagement' and 'Provider' tags. Please check if the specified package has the tags.

上面的脚本是通过 Powershell ISE 执行的 以管理员身份运行,并以域管理员身份登录。

powershell nuget adfs adfs4.0
2个回答
11
投票

强制 PowerShell 使用 TLS 1.2,然后执行命令。我在 TLS 1 截止日期之后遇到了这个问题:

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

0
投票

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

如果您是运行命令的系统,则效果同样好。另外,您可以通过检查键入来检查它是否已安装:

它应该返回值:

C:> Tls12

© www.soinside.com 2019 - 2024. All rights reserved.