1

I am trying to install PowerShell Community Extensions (required to get Invoke-BatchFile) within my docker:

FROM mcr.microsoft.com/windows/servercore:ltsc2022
[...]
RUN Install-Module Pscx -Scope CurrentUser -Confirm:$false -Force

The above always returns with the following error:

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

How is one supposed to install Pscx ? Since PSCX is no longer distributed via Codeplex or as an MSI, but only on the Powershell Gallery I cannot use chocolatey.

1 Answer 1

1

Turns out that the solution is simply:

RUN Install-PackageProvider -Name NuGet -Force
RUN Install-Module -Name Pscx -RequiredVersion 3.2.1.0 -Force -AllowClobber

Solution was found at:

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.