为什么我在尝试安装 PSWindowsUpdate 时收到此错误?我在所有新服务器上都会遇到此错误。
[root@salt ~]# salt 'Windows001' psget.install PSWindowsUpdate
Windows001:
ERROR: Issue executing powershell Install-Module -Name PSWindowsUpdate -Force | ConvertTo-Xml -Depth 2 -As "stream". Additional info follows:
retcode:
1
stderr:
Exception calling "ShouldContinue" with "2" argument(s): "Windows PowerShell is in NonInteractive mode. Read and
Prompt functionality is not available."
At C:\Program Files\WindowsPowerShell\Modules\PowerShellGet\1.0.0.1\PSModule.psm1:7455 char:8
+ if($Force -or $psCmdlet.ShouldContinue($shouldContinueQueryMessag ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException
+ FullyQualifiedErrorId : PSInvalidOperationException
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.
At line:1 char:1
+ Install-Module -Name PSWindowsUpdate -Force | ConvertTo-Xml -Depth 2 ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [Install-Module], InvalidOperationException
+ FullyQualifiedErrorId : CouldNotInstallNuGetProvider,Install-Module
stdout:
ERROR: Minions returned with non-zero exit code
请确保安装“2.8.5.201”或更新版本的 NuGet 提供程序。
想通了。我必须按照文档运行
psget.bootstrap
。这将确保远程安装最新版本的 NuGet。
[root@salt ~]# salt 'Windows001' psget.bootstrap
Windows001:
----------
NuGet:
----------
Name:
NuGet
ProviderPath:
C:\Program Files\PackageManagement\ProviderAssemblies\nuget\2.8.5.208\Microsoft.PackageManagement.NuGetProvider.dll
Version:
2.8.5.208
[root@salt ~]# salt 'Windows001' psget.install PowerPlan
Windows001:
True