JustinGrote / JustinGrote/ModulePath

Get-ModulePath -AllUsers returns wrong folder path

Open
#1 1 comment 0 reactions 0 assignees View on GitHub
bug
Dominant language
PowerShell
Stars
25
Forks
0
PR merge metrics
No merged PRs in 30d

Description

When running `Get-ModulePath` with _-AllUsers_ parameter, the returned folder refers to modules that are included with PowerShell, not AllUsers path.

The problem is in https://github.com/JustinGrote/ModulePath/blob/main/ModulePath.psm1#L103, where GetPSModulePath method uses wrong scope reference. The reference should be **Machine** instead of **BuiltIn**.

The problem only surfaces, when there is no custom path in .config.json file.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start at ModulePath.psm1 line 103 and inspect the GetPSModulePath scope reference. Reproduce the case with no custom path in .config.json by running Get-ModulePath -AllUsers; done means it returns the AllUsers module path rather than the PowerShell built-in modules path.

Written by the indexing model from the issue text.

Assessment

Tech stack
powershell
Domain
tooling
Issue type
Bug
Difficulty
1/5
Estimated time
Under an hour
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
50/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.