-
Notifications
You must be signed in to change notification settings - Fork 10
Closed
Labels
bugSomething isn't workingSomething isn't workinghelp wantedExtra attention is neededExtra attention is needed
Description
Hey,
was testing this out a bit,
I was just curious if this wouldnt make more sense to be changed,
Install-ModuleFast -Name Az.CosmosDB -Destination CurrentUser
WARNING: Parameter -Destination is set to a custom path not in your current PSModulePath. We will add it to your PSModulePath for this session. You can suppress this behavior with the -NoPSModulePathUpdate switch.
# it needs to be
Install-ModuleFast 'Az.CosmosDB' -Destination 'CurrentUser' -NoProfileUpdate -NoPSModulePathUpdateBut the implication when you choose 'CurrentUser' (on Windows)
elseif ($IsWindows -and $Destination -eq 'CurrentUser') {
$windowsDefaultDocumentsPath = Join-Path ([Environment]::GetFolderPath('MyDocuments')) 'PowerShell/Modules'
$Destination = $windowsDefaultDocumentsPath
# so you could add
$NoPSModulePathUpdate = $true
$NoProfileUpdate = $true
}That already means we do not need to update the $env:PSModulePath or the $Profile so could just disable the updates.
as i was typing this out i found the bug that was causing it.
$PSModulePaths is not defined
if (-not $NoPSModulePathUpdate) {
if ($defaultRepoPath -ne $Destination -and $Destination -notin $PSModulePaths) {
Write-Warning 'Parameter -Destination is set to a custom path not in your current PSModulePath. We will add it to your PSModulePath for this session. You can suppress this behavior with the -NoPSModulePathUpdate switch.'
$NoProfileUpdate = $true
}just needs to add
$PSModulePaths = $env:PSModulePath.Split([Path]::PathSeparator, [StringSplitOptions]::RemoveEmptyEntries)to Install-ModuleFast function
could still set the values in the'CurrentUser' block so it skips NoPSModulePathUpdate check for that scenario.
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workinghelp wantedExtra attention is neededExtra attention is needed