Skip to content

PackageManagement module fails to update when using AppLocker #1278

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
johlju opened this issue Apr 30, 2020 · 4 comments · Fixed by #1288
Closed

PackageManagement module fails to update when using AppLocker #1278

johlju opened this issue Apr 30, 2020 · 4 comments · Fixed by #1288
Labels

Comments

@johlju
Copy link

johlju commented Apr 30, 2020

The preview extension asks to replace the PackageManagement module which throws an error when using AppLocker (ConstrainedLanguage mode).

image

PackageManagement\Install-Package : An error has occurred while loading script module PackageManagement because it has a different language mode than the module manifest. The manifest la
nguage mode is ConstrainedLanguage and the module language mode is FullLanguage. Ensure all module files are signed or otherwise part of your application allow list configuration.

Originally posted by @johlju in #1221 (comment)

@ghost ghost added the Needs: Triage Maintainer attention needed! label Apr 30, 2020
@TylerLeonhardt
Copy link
Member

@johlju do you have any policies set up for PackageManagement or PowerShell built-in modules or signatures?

Also, what version of PowerShellGet are you using?

@ghost ghost added the Needs: Maintainer Attention Maintainer attention needed! label May 1, 2020
@TylerLeonhardt TylerLeonhardt added Needs-Repro-Info and removed Needs: Maintainer Attention Maintainer attention needed! Needs: Triage Maintainer attention needed! labels May 1, 2020
@johlju
Copy link
Author

johlju commented May 5, 2020

...do you have any policies set up for PackageManagement or PowerShell built-in modules or signatures?

Yes, we allow running the modules under %programfiles%\WindowsPowerShell\Modules on these dev workstations.

Also, what version of PowerShellGet are you using?

PowerShellGet has not been replaced with a newer one, still the one that came with Windows 10 I guess.

ModuleType Version    Name
---------- -------    ----
Script     1.0.0.1    PowerShellGet

Although myself do not have local admin permission so I waiting for a colleague to verify this still exist when running VS Code with elevation, which I guess is needed to replace/update the PackageManagement module, unless it will update to -Scope CurrentUser?

I saw now that it do indeed try to update to the scope CurrentUser.

PS> powershell.exe -NoLogo -NoProfile -Command 'Install-Module -Name PackageManagement -Force -MinimumVersion 1.4.6 -Scope CurrentUser -AllowClobber'

PackageManagement\Install-Package : An error has occurred while loading script module PackageManagement because it has a different language mode than the module manifest. The manifest language mode is ConstrainedLanguage and the module language mode is FullLanguage. Ensure all
 module files are signed or otherwise part of your application allow list configuration.
At C:\Program Files\WindowsPowerShell\Modules\PowerShellGet\1.0.0.1\PSModule.psm1:1809 char:21
+ ...          $null = PackageManagement\Install-Package @PSBoundParameters
+                      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (Microsoft.Power....InstallPackage:InstallPackage) [Install-Package], Exception
    + FullyQualifiedErrorId : Modules_MismatchedLanguageModes,Microsoft.PowerShell.Commands.TestModuleManifestCommand,Microsoft.PowerShell.PackageManagement.Cmdlets.InstallPackage

@TylerLeonhardt
Copy link
Member

I have a "fix" out for this that doesn't run a command on your behalf because apparently PackageManagement doesn't play well in CLM...

There's also a setting to disable this warning already... though, keep in mind, you're using a version of PackageManagement that could lock up the PowerShell extension if you don't update it...

@TylerLeonhardt TylerLeonhardt added Area-Startup Issue-Bug A bug to squash. and removed Needs: Maintainer Attention Maintainer attention needed! labels May 6, 2020
@johlju
Copy link
Author

johlju commented May 7, 2020

Then I suggest we close this issue once that PR is through.

We can distribute the module (PackageManagement and PowerShellGet) centrally, for example together with the deployment of VS Code (for PowerShell dev stations).

@ghost ghost added the Needs: Maintainer Attention Maintainer attention needed! label May 7, 2020
@ghost ghost added Status: Fixed and removed Status: In PR labels May 11, 2020
@TylerLeonhardt TylerLeonhardt removed the Needs: Maintainer Attention Maintainer attention needed! label Oct 15, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants