我正在尝试在我的docker中安装PowerShell社区扩展(需要获得Invoke-BatchFile
):
FROM mcr.microsoft.com/windows/servercore:ltsc2022
[...]
RUN Install-Module Pscx -Scope CurrentUser -Confirm:$false -Force
上面的总是返回以下错误:
Install-NuGetClientBinaries : Exception calling "ShouldContinue" with "2"
argument(s): "Object reference not set to an instance of an object."
At C:\Program
Files\WindowsPowerShell\Modules\PowerShellGet\1.0.0.1\PSModule.psm1:1762 char:9
+ Install-NuGetClientBinaries -CallerPSCmdlet $PSCmdlet -Proxy ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Install-NuGetClientBinaries],
MethodInvocationException
+ FullyQualifiedErrorId : NullReferenceException,Install-NuGetClientBinari
es
如何安装Pscx?由于PSCX不再通过Codeplex或作为MSI分发,而是仅在Powershell Gallery上分发,因此我无法使用chocolatey。
1条答案
按热度按时间2sbarzqh1#
事实证明,解决方案很简单:
在以下位置找到解决方案: