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

-NoProfile should not add Modules folder under the user profile in PSModulePath #23957

Open
5 tasks done
ocalvo opened this issue Jun 14, 2024 · 3 comments
Open
5 tasks done
Labels
Needs-Triage The issue is new and needs to be triaged by a work group.

Comments

@ocalvo
Copy link

ocalvo commented Jun 14, 2024

Prerequisites

Steps to reproduce

  1. Start cmd
  2. Clear the environment variable PSModulePath
  3. Start pwsh.exe -noprofile
  4. Evaluate $env:PSModulePath

Expected behavior

PSModulePath should not include any path under the user profile.

Actual behavior

PSModulePath includes paths under the user profile.

Error details

N/A

Environment data

Name                           Value
----                           -----
PSVersion                      7.4.2
PSEdition                      Core
GitCommitId                    7.4.2
OS                             Microsoft Windows 10.0.26236
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

Visuals

N/A

@ocalvo ocalvo added the Needs-Triage The issue is new and needs to be triaged by a work group. label Jun 14, 2024
@ocalvo ocalvo changed the title -NoProfile should not add Modules folder under the profile in PSModulePath -NoProfile should not add Modules folder under the user profile in PSModulePath Jun 14, 2024
@MartinGC94
Copy link
Contributor

Why shouldn't it include those modules? It's not unreasonable to think someone would want to skip loading the $profile script(s) while still having those modules available. It would be better to ask for a new switch if you think it's useful to exclude user scoped modules.

@ocalvo
Copy link
Author

ocalvo commented Jun 14, 2024

Agree, will it be possible to introduce a new flag -NoModulePath ?

@ThomasNieto
Copy link
Contributor

Can you please explain the use case for this feature?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Needs-Triage The issue is new and needs to be triaged by a work group.
Projects
None yet
Development

No branches or pull requests

3 participants