Salt -无法远程安装Powershell模块

uyhoqukh  于 2023-03-30  发布在  Shell
关注(0)|答案(2)|浏览(157)

为什么我在尝试安装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
yhived7q

yhived7q1#

请确保已安装“2.8.5.201”或更新版本的NuGet提供程序。

7y4bm7vi

7y4bm7vi2#

想通了,我不得不按照文档运行psget.bootstrap

[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

相关问题