Closed
Description
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?