Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HKCU may not have Environment (Install of Chocolatey) #375

Closed
ferventcoder opened this issue Jul 30, 2015 · 2 comments
Closed

HKCU may not have Environment (Install of Chocolatey) #375

ferventcoder opened this issue Jul 30, 2015 · 2 comments

Comments

@ferventcoder
Copy link
Member

Trying to install Chocolatey from the install script located here - https://chocolatey.org/install.ps1, and when run it looks like it is erroring out when trying to read and expand properties from the registry key 'HKCU:\Environment'.
This is possibly because I am doing this on a Windows Server 2012 R2 Core install and it does not have the registry key 'HKCU:\Environment'.

https://groups.google.com/d/msgid/chocolatey/e779ca75-3a14-4d61-a575-339802c59d1b%40googlegroups.com

@Ian2020
Copy link

Ian2020 commented Jul 15, 2016

Seen this on Server 2012 R2 Standard also. Can reproduce if any further information would help. (edit: google group link above works now I've signed up to the group, thanks Rob)

@ferventcoder
Copy link
Member Author

@Ian2020 the link works after you've signed up for the group. We've had issues with Google not properly masking email addresses in the threads so we require you to join to cut down on spammers.

@ferventcoder ferventcoder modified the milestones: 0.9.10.4, 0.9.10.x Jul 15, 2016
@ferventcoder ferventcoder self-assigned this Aug 3, 2016
ferventcoder added a commit that referenced this issue Aug 10, 2016
When attempting to expand or work with `HKCU:\Environment`, that can
error due to not having an existing `Environment` key in HKCU. This can
occur in certain Windows Server versions, such as Server Core which
doesn't have the key. This can also happen in other situations as well.

- In `Get-EnvironmentVariableNames`, when expanding from
   `HKCU:\Environment` and it fails, silently continue.
- When attempting to remove variables at User scope for
   Get-ToolsLocation, fail those silently.
- If you can't set the Get-ToolsLocation value for User scope, attempt
   Machine scope instead.
- With `Install-ChocolateyEnvironmentVariable`, if the attempt to set
   to User scope fails and the user is an administrator, attempt to set
   it with Machine scope. Otherwise fail.
- In `Get-EnvironmentVariable`, if the registry key is null, do not
   attempt to grab a value or close it.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants