我正在尝试在许多服务器上安装Install-Module -Name SqlServer -confirm:$false
。我以管理员身份运行
尽管我已指定-confirm:$false
NuGet provider is required to continue
PowerShellGet requires NuGet provider version '2.8.5.201' or newer to interact with NuGet-based repositories. The NuGet
provider must be available in 'C:\Program Files\PackageManagement\ProviderAssemblies' or
'C:\Users\\AppData\Local\PackageManagement\ProviderAssemblies'. You can also install the NuGet provider by
running 'Install-PackageProvider -Name NuGet -MinimumVersion 2.8.5.201 -Force'. Do you want PowerShellGet to install
and import the NuGet provider now?
[Y] Yes [N] No [S] Suspend [?] Help (default is "Y"):
我也尝试了-force
,同样,它不断提示我确认...
这不是理想的,因为如果我想使用脚本来安装模块,我将必须在那里进行确认,这违背了目的
答案 0 :(得分:1)
它很复杂;您要安装的模块依赖于NuGet
软件包提供程序,并且不会抑制安装依赖项的提示。
但是...您可以先运行它:
Install-PackageProvider -Name NuGet -MinimumVersion 2.8.5.201 -Force
那你应该没事!
答案 1 :(得分:1)
尝试一下:
Install-PackageProvider NuGet -Force
Set-PSRepository PSGallery -InstallationPolicy Trusted
Install-Module SqlServer -Confirm:$False -Force