Skip to content

GetPersonalModulePath() should be made a public method, and be configurable from powershell.config.json #18613

Description

Summary of the new feature / enhancement

"As a user, I want to specify where my modules are installed by default, such as a non-OneDrive path or another drive for performance"

While a powershell.config.json setting exists to allow configuration of the PSModulePath, it does not allow someone to set the default install location for modules. The logic for this is hidden in an internal method, and as a result, products like PowerShellGet v2, PowershellGetv3, and ModuleFast have their own separate internal implementations that mirror this method.

By making the method public, and making the target overridable in powershell.config.json, package management tools can tie into PowerShell to be consistent with the intent of the use.

Proposed technical implementation details (optional)

Update this to be public:
https://github.com/PowerShell/PowerShell/blob/9ae18ab0d18abea0569b691693e864adb77baeb5/src/System.Management.Automation/engine/Modules/ModuleIntrinsics.cs#LL962-L970C10

And add a powershell.config.json setting that will be checked by this method and override the default behavior if specified.

I am willing to attempt a PR if this is marked up-for-grabs

Activity

  1. SteveL-MSFT commented on Nov 21, 2022

    @SteveL-MSFT
    Member

    I believe James Truher (@JamesWTruher) was going to tackle this as a pre-requisite to #15552. Specifically exposing an API to retrieve the user, shared, and system module paths. This would be needed by PowerShellGet rather than using a priori knowledge. I believe Jim had some concerns with simply making those APIs public instead of some sanitized versions, but don't recall the details.

  2. KirillOsenkov commented on Apr 4, 2024

    @KirillOsenkov

    Can we please reactivate

  3. JustinGrote commented on Apr 4, 2024

    @JustinGrote
    ContributorAuthor

    Kirill Osenkov (@KirillOsenkov) for note I am not a maintainer of the PowerShell repo, I'm just a community member, there's nothing I can do in this regard.

  4. KirillOsenkov commented on Apr 4, 2024

    @KirillOsenkov

    sorry I thought you could reactivate as the author

  5. MatejKafka commented on Apr 5, 2024

    @MatejKafka
    Contributor

    Ryan Yates (@kilasuit) not completed, please reopen

  6. added
    KeepOpenThe bot will ignore these and not auto-close
    and removed
    Resolution-No ActivityIssue has had no activity for 6 months or more
    on Apr 12, 2024
  7. 6 remaining items

  8. added and removed
    Needs-TriageThe issue is new and needs to be triaged by a work group.
    WG-NeedsReviewNeeds a review by the labeled Working Group
    KeepOpenThe bot will ignore these and not auto-close
    on Sep 16, 2024
  9. SeeminglyScience commented on Sep 16, 2024

    @SeeminglyScience
    Contributor

    Note that I've marked it as declined here but it could probably more easily be labeled as duplicate. The feature itself is still planned and tracked separately, the specific implementation suggestion is declined. Hopefully that makes sense

  10. JustinGrote commented on Sep 16, 2024

    @JustinGrote
    ContributorAuthor

    Yep makes sense, closing here.

  11. microsoft-github-policy-service commented on Sep 16, 2024

    @microsoft-github-policy-service
    Contributor

    📣 Hey Justin Grote (@JustinGrote), how did we do? We would love to hear your feedback with the link below! 🗣️

    🔗 https://aka.ms/PSRepoFeedback

  12. microsoft-github-policy-service commented on Sep 16, 2024

    @microsoft-github-policy-service
    Contributor

    📣 Hey Justin Grote (@JustinGrote), how did we do? We would love to hear your feedback with the link below! 🗣️

    🔗 https://aka.ms/PSRepoFeedback

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

    Issue-Enhancementthe issue is more of a feature request than a bugResolution-DeclinedThe proposed feature is declined.WG-Enginecore PowerShell engine, interpreter, and runtime

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions