Skip to content

Update and Install-Module Removes Custom PSModulePaths from Current Scope #9845

Closed

Description

When you set custom PSModulePaths and then run update-module or install-module for modules, even if they weren't installed through PSGallery, the custom module paths are unloaded from the current scope.

Also, Modules that were installed from PSGallery are not updated, regardless if they are in the default or custom Module paths.

This was tested with the AzureAD module. Closing the current PoSH Window and re-opening reloads all PSModulePaths (even custom ones).

Steps to reproduce

Install-Module <ModuleName>

or

Update-Module <ModuleName>

Expected behavior

Install module if it is available from the repository and not unload PSModulePath that aren't default.

Update module that was installed from repository and not unload PSModulePath that aren't default.

Actual behavior

Installs the module requested and then unloads the custom module paths set for the $Env:PSModulePath

Fails to Update the module (even ones installed from repository) and then unloads the custom module paths set for $Env:PSModulePath

Environment data

Name                           Value
----                           -----
PSVersion                      7.0.0-preview.1
PSEdition                      Core
GitCommitId                    7.0.0-preview.1
OS                             Microsoft Windows 10.0.18362
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

Activity

  1. ghost added
    Issue-Questionideally support can be provided via other mechanisms, but sometimes folks do open an issue to get a
    on Jun 6, 2019
  2. iSazonov commented on Sep 16, 2019

    @iSazonov
    Collaborator

    Dilydali (@Dilydali) Please add more info in repo steps. Do you update PSModulePath in current session by changing $env:PSModulePaths?

  3. iSazonov commented on Jan 30, 2020

    @iSazonov
    Collaborator

    /cc Steve Lee (@SteveL-MSFT) Perhaps the issue was fixed.

  4. added
    WG-Enginecore PowerShell engine, interpreter, and runtime
    Issue-BugIssue has been identified as a bug in the product
    and removed
    Issue-Questionideally support can be provided via other mechanisms, but sometimes folks do open an issue to get a
    on May 7, 2020
  5. added this to the 7.1-Consider milestone on May 7, 2020
  6. joeyaiello commented on Jul 30, 2020

    @joeyaiello
    Contributor

    Dilydali (@Dilydali) could you please try this with the latest preview of PowerShellGet 3.0? If it's still happening, please file an issue at PowerShell/PowerShellGet

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Area-PowerShellGetspecific to PowerShellGet moduleIssue-BugIssue has been identified as a bug in the productResolution-ExternalThe issue is caused by external component(s).WG-Enginecore PowerShell engine, interpreter, and runtime

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions