GoogleCloudPlatform / google-cloud-powershell

PowerShell cmdlets for the Google Cloud Platform
http://googlecloudplatform.github.io/google-cloud-powershell/
Apache License 2.0
135 stars 61 forks source link

SDK Windows Installer breaks PSModulePath when installed for single user #611

Closed LKajan closed 6 years ago

LKajan commented 6 years ago

When installing for single user PSModulePath breaks just like in #524. That Issue was closed by author before it got fixed.

Before installation the $env:PSModulePath looks like this:
C:\Users\lauri\Documents\WindowsPowerShell\Modules;C:\Program Files\WindowsPowerShell\Modules;C:\WINDOWS\system32\WindowsPowerShell\v1.0\Modules

And after the installation like this:
;C:\Users\lauri\AppData\Local\Google\Cloud SDK\google-cloud-sdk\platform\PowerShell;C:\Program Files\WindowsPowerShell\Modules;C:\WINDOWS\system32\WindowsPowerShell\v1.0\Modules

My C:\Users\lauri\Documents\WindowsPowerShell\Modules is now missing from the combined $env:PSModulePath.

The installer adds a new User ENV variable PSModulePath with value ';C:\Users\lauri\AppData\Local\Google\Cloud SDK\google-cloud-sdk\platform\PowerShell'. When this variable exists Windows doesn't "append" User's own module path automatically to the $env:PSModulePath. If I add a %USERPROFILE%\Documents\WindowsPowerShell\Modules to the User PSModulePath env variable everything works ok.

quoctruong commented 6 years ago

@LKajan Are you installing as administrator or non-administrator?

LKajan commented 6 years ago

Thanks for your reply. I tried both and the result is same.

quoctruong commented 6 years ago

@LKajan Thanks for the reply. Do you know if this happens to other machines that you have?

LKajan commented 6 years ago

I tested this with two different computers with the same result. And then there is that #524 with the same problem.

quoctruong commented 6 years ago

@LKajan Unfortunately, I wasn't able to repro the issue and the installation code logic also looks correct. A work around for this would be to install the module from the PowerShell gallery with Install-Module GoogleCloud. This would get you the latest version of the module as well.

taavikuusik commented 5 years ago

Yup, this is still broken 8 months later - installing Google Cloud SDK by running installer breaks existing PowerShell environment.

m-ender commented 5 years ago

I also just had this happen.

malkia commented 5 years ago

Not sure if the case, but this might be breaking folks here - https://github.com/docker/for-win/issues/4452 (me too included, though it started for me after upgrading WIndows from 1806 to 1903)

bab014 commented 3 years ago

Same thing happened to me. Installed Cloud SDK via the installer and none of my Modules can now be found.