Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -773,7 +773,7 @@ def munge_psmodulepath(resource)
<<~MUNGE_PSMODULEPATH.strip
$UnmungedPSModulePath = [System.Environment]::GetEnvironmentVariable('PSModulePath','machine')
$MungedPSModulePath = $env:PSModulePath + ';#{vendor_path}'
[System.Environment]::SetEnvironmentVariable('PSModulePath', $MungedPSModulePath, [System.EnvironmentVariableTarget]::Machine)
Set-ItemProperty -Path 'HKLM:\\SYSTEM\\CurrentControlSet\\Control\\Session Manager\\Environment' -Name 'PSModulePath' -Value $MungedPSModulePath
$env:PSModulePath = [System.Environment]::GetEnvironmentVariable('PSModulePath','machine')
MUNGE_PSMODULEPATH
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Try {
} Finally {
If (![string]::IsNullOrEmpty($UnmungedPSModulePath)) {
# Reset the PSModulePath
[System.Environment]::SetEnvironmentVariable('PSModulePath', $UnmungedPSModulePath, [System.EnvironmentVariableTarget]::Machine)
Set-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager\Environment' -Name 'PSModulePath' -Value $UnmungedPSModulePath
$env:PSModulePath = [System.Environment]::GetEnvironmentVariable('PSModulePath', 'machine')
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1529,7 +1529,7 @@
end

it 'updates the system PSModulePath to $MungedPSModulePath' do
expect(result).to match(/SetEnvironmentVariable\('PSModulePath', \$MungedPSModulePath/)
expect(result).to match(/-Name 'PSModulePath' -Value \$MungedPSModulePath/)
end

it 'sets the process level PSModulePath to the modified system PSModulePath' do
Expand Down