PowerShell / PowerShell/PSResourceGet
`Get-PSResource` does not search in user context environment variable `PSModulePath`
Nessuno ha ancora preso questa issue.
- Lingua principale
- C#
- Stelle
- 576
- Fork
- 114
- Merge medio
- 1g 2h
- PR unite (30g)
- 7
Descrizione
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
PackageManagement, PowerShellGetv2 and PowerShellGet 3.0.18-beta (and prior versions) does not search in directorories specified in user context environmental variable PSModulePath when searching for modules. But at least v3 has a -Path parameter.
Reproduce:
- Install
Az.Accountsto%LOCALAPPDATA%\Microsoft\PowerShell\Modulesby usingSave-PSResource. - Make sure said module is not installed any other places specified in
$env:PSModulePath.- Or rather any other default locations for PowerShell modules I guess.
- Make sure
%LOCALAPPDATA%\Microsoft\PowerShell\Modulesis specified inHKCU:\Environment\PSModulePath, and that PowerShell loaded it into$env:PSModulePathat start. Should also be seen in[System.Environment]::GetEnvironmentVariable('PSModulePath','User'). - Search for installed modules with
PowerShellGet\Get-PSResource -Name 'Az.Accounts'. Result: Not found. - Add
-Scope 'CurrentUser: Nope, still not found. - Add
-Path ('{0}\Microsoft\PowerShell\Modules' -f $env:LOCALAPPDATA): Found.
Microsoft.PowerShell.Core\Import-Module and Get-Module works as expected.
Expected behavior
PowerShellGet\Get-PSResource should search in all PSModulePath paths, also those specified in user context environmental variable.
Actual behavior
It does not.
Error details
No response
Environment data
PowerShellGet v3.0.18
Windows PowerShell 5.1 x64 on Windows 10 22H2
Visuals
No response
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Direzione di ricerca
Inizia riproducendo il caso Windows PowerShell 5.1 con Get-PSResource -Name 'Az.Accounts' e una voce PSModulePath nel contesto dell'utente. Traccia l'implementazione della ricerca di Get-PSResource e confronta la gestione dei percorsi con i casi espliciti -Path e -Scope CurrentUser. Il lavoro è completato quando le risorse nelle posizioni PSModulePath del contesto dell'utente vengono trovate senza specificare -Path, con una copertura di regressione per questo scenario.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- csharp, powershell
- Ambito
- cli, tooling
- Tipo di issue
- Bug
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Stato di attività
- Ferma
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 38/100