PowerShell / PowerShell/PSResourceGet
PSResourceGet exports the $PSGetPath variable but never sets the value
Nobody has claimed this yet.
- Dominant language
- C#
- Stars
- 576
- Forks
- 114
- Avg merge
- 1d 2h
- Merged PRs (30d)
- 7
Description
Prerequisites
- Write a descriptive title.
- Make sure you are able to repro it on the latest released version
- Search the existing issues.
Steps to reproduce
In a new session import PSResourceGet but don't import PowerShellGet v2. Examine the value of $PSGetPath.
Expected behavior
PS> Get-Variable PSGetPath -ValueOnly
AllUsersModules : C:\Program Files\PowerShell\Modules
AllUsersScripts : C:\Program Files\PowerShell\Scripts
CurrentUserModules : C:\Users\sewhee\Documents\PowerShell\Modules
CurrentUserScripts : C:\Users\sewhee\Documents\PowerShell\Scripts
Actual behavior
PS> Get-Variable PSGetPath -ValueOnly
Get-Variable: Cannot find a variable with the name 'PSGetPath'.
Error details
No error.
The variable $PSGetPath was added to PowerShellGet v2 in https://github.com/PowerShell/PowerShellGetv2/pull/486. The variable is never used by the modules, it is provided to give users information about the location of the Modules and Scripts folder for each scope.
PSResourceGet exports the variable in the module manifest, but nowhere in code does it set the value.
Environment data
PS> gmo -list Microsoft.PowerShell.PSResourceGet
Directory: C:\Users\sewhee\Documents\PowerShell\Modules
ModuleType Version PreRelease Name PSEdition ExportedCommands
---------- ------- ---------- ---- --------- ----------------
Binary 1.0.2 Microsoft.PowerShell.PSResourceGet Core,Desk {Find-PSResource, Get-InstalledPSResour…
Binary 1.0.0 Microsoft.PowerShell.PSResourceGet Core,Desk {Find-PSResource, Get-InstalledPSResour…
Visuals
No response
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by importing Microsoft.PowerShell.PSResourceGet without PowerShellGet v2 and reproducing the missing variable with Get-Variable PSGetPath. Inspect the module manifest export and the module initialization code, which the issue says never sets the value. Done means the variable is available after import and reports the four module and script paths shown in the expected behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- powershell
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100