Skip to content
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

Request to change default installation path for user modules #724

Open
mgreenegit opened this issue Jul 20, 2022 · 6 comments
Open

Request to change default installation path for user modules #724

mgreenegit opened this issue Jul 20, 2022 · 6 comments
Milestone

Comments

@mgreenegit
Copy link
Member

Summary of the new feature / enhancement

In the latest versions of OneDrive, the Documents folder is synchronized by default. This creates challenges for PowerShell users. Some might not want modules to "roam" between machines. In other cases, an organizational "My" folder always contains two spaces in the name following the pattern "OneDrive - OrgName". The spaces require using an 8.3 folder name or putting the path in quotations, which is extra work.

A community-suggested workaround is to move the default module path. The discussion resolved the best location to be ~/AppData/Local/PowerShell/Modules. The PowerShell committee has discussed and agrees with the approach and acknowledges that multiple steps in a coordinated effort will be required to reach the end goal without breaking compatibility.

PowerShell/PowerShell#15552

Proposed technical implementation details (optional)

Two options for consideration, regarding Install-PSResource:

1 - Add a new parameter -InstallPath and set the default to $Env:HOMEPATH\AppData\Local\PowerShell\Modules.
2 - Just change the path where modules are installed to $Env:HOMEPATH\AppData\Local\PowerShell\Modules, without adding a parameter.

Additional options and considerations are welcome. If this is accepted, PWSH could add the path to PSModulePath (in addition to the existing) in a near-term release.

@ThomasNieto
Copy link
Contributor

Related/Duplicate: https://github.com/PowerShell/PowerShellGet/issues/627

@JustinGrote
Copy link
Contributor

Related Linux should follow DBG conventions and save it in ~/.config/powershell/Modules

@markdomansky
Copy link

markdomansky commented Jul 21, 2022

100% support this. The target path (for windows) makes perfect sense as well.

Regarding migration:

  • Leave already installed modules where they are.
  • Leave the old path (for existing users) in the PSModulePath (but it could be removed for new profiles)
  • Add a cmdlet to migrate existing modules (Move-PSResource?). This could also allow migrating a currentuser module to machine (or back).
  • Consider Get/Set-PSResourcePath to set currentuser, default currentuser and machine paths?

@KevinMarquette
Copy link

KevinMarquette commented Jul 21, 2022

I second ~/AppData/Local/PowerShell/Modules location. Thats the first place I thought. It should be added in addition to the existing paths.

I would like to have a trivial way to inquire where the AllUser and CurrentUser scope install folders are. I see lots of repeated hard coded logic in scripts trying to figure this out on the fly. (checking OS and PS version, ect)

I don't think -InstallPath parameter is needed, but I would name it -Path (possibly with an alias of -InstallPath) to align with Save-PSResource.

@JustinGrote
Copy link
Contributor

Install Path locations are pseudo-hard coded into PSGetV2 and PSGetV3. Either those modules should expose an API for the install locations or (even better), PowerShell engine should have an API that produces the recommended paths that is customizable preferably by a Cmdlet you put in your profile but a config.json or config.psd1 file somewhere would also work

@weyCC81 weyCC81 mentioned this issue Nov 7, 2022
10 tasks
@alerickson alerickson added this to the vNext milestone Jan 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants