8000 Installing chocolatey removes $env:PSModulePath changes for current powershell session · Issue #295 · chocolatey/choco · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
Installing chocolatey removes $env:PSModulePath changes for current powershell session #295
Closed
@chrissimon-au

Description

@chrissimon-au

When installing in a powershell process with something like:

iex ((new-object net.webclient).DownloadString('https://chocolatey.org/install.ps1'))

After the install, $env:PSModulePath has reverted to the Machine level environment variable.

This is causing problems for me as the Machine level variable only has:

 C:\Windows\system32\WindowsPowerShell\v1.0\Modules\;C:\Program Files (x86)\AWS Tools\PowerShell\

But as part of establishing a powershell session, $env:PSModulePath looks like:

C:\Users\Administrator\Documents\WindowsPowerShell\Modules;C:\Program Files\WindowsPowerShell\Modules;C:\Windows\system32\WindowsPowerShell\v1.0\Modules\;C:\Program Files (x86)\AWS Tools\PowerShell\

After installing chocolatey, it reverts to:

 C:\Windows\system32\WindowsPowerShell\v1.0\Modules\;C:\Program Files (x86)\AWS Tools\PowerShell\

And the absence of the Documents and Program Files paths causes problems for other things I'm trying to do in the same script.

Seems likely this is being done by Update-SessionEnvironment. The need for Update-SessionEnvironment is clear, but could it possible merge with the existing $env:PSModulePath rather than assuming that the process has not yet modified it?

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

    0