Prerequisites
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.Accounts to %LOCALAPPDATA%\Microsoft\PowerShell\Modules by using Save-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\Modules is specified in HKCU:\Environment\PSModulePath, and that PowerShell loaded it into $env:PSModulePath at 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
Error details
No response
Environment data
PowerShellGet v3.0.18
Windows PowerShell 5.1 x64 on Windows 10 22H2
Visuals
No response
Prerequisites
Steps to reproduce
PackageManagement,PowerShellGetv2andPowerShellGet3.0.18-beta (and prior versions) does not search in directorories specified in user context environmental variablePSModulePathwhen searching for modules. But at least v3 has a-Pathparameter.Reproduce:
Az.Accountsto%LOCALAPPDATA%\Microsoft\PowerShell\Modulesby usingSave-PSResource.$env:PSModulePath.%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').PowerShellGet\Get-PSResource -Name 'Az.Accounts'. Result: Not found.-Scope 'CurrentUser: Nope, still not found.-Path ('{0}\Microsoft\PowerShell\Modules' -f $env:LOCALAPPDATA): Found.Microsoft.PowerShell.Core\Import-ModuleandGet-Moduleworks 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
Visuals
No response