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

Replace registry_key with reg.exe #1

Closed
dhoer opened this Issue Mar 23, 2015 · 3 comments

Comments

Projects
None yet
2 participants
@dhoer
Owner

dhoer commented Mar 23, 2015

While Chef's registry_key is great for configuring a current user that the chef-client is running as, it falls down when it comes to configuring default settings for new users and configuring existing users. To do that, you need to update the appropriate user's hive file ntuser.dat.

The Windows way is to use regedt32.exe application and "load hive" menu option to load the file into a registry key and then edit that key, then unload the hive again. But if you want to do it from a script or command line, you need the reg.exe command line utility.

Step 1 - Load User Registry Hive
reg.exe load HKCU\{username} c:\users\{username}\ntuser.dat

Step 2 - Make a normal .reg file and import it
reg.exe import "update.reg"

Step 3 - Commit and Unload User Registry Hive
reg.exe unload HKCU\{username}

This approach can be wrapped in a LWRP that would take a .reg.erb template file.

windows_reg 'config_ie_for_selenium' do
  source 'selenium.reg.erb'
  cookbook 'ie'
  users ['selenium']
  variables(
    local_home: node['ie]['zone']['local_home']
    ...
  )
end

@dhoer dhoer added the enhancement label Mar 23, 2015

@dhoer dhoer changed the title from Replace recipes with windows_reg lwrp to Replace registry_key call with reg.exe Mar 23, 2015

@dhoer dhoer changed the title from Replace registry_key call with reg.exe to Replace registry_key with reg.exe Mar 23, 2015

@mhemesath

This comment has been minimized.

Show comment
Hide comment
@mhemesath

mhemesath Mar 29, 2015

+1 This would be useful. Currently my selenium user is not my chef user so I need to set some of these settings manually.

mhemesath commented Mar 29, 2015

+1 This would be useful. Currently my selenium user is not my chef user so I need to set some of these settings manually.

@dhoer

This comment has been minimized.

Show comment
Hide comment
@dhoer

This comment has been minimized.

Show comment
Hide comment

@dhoer dhoer closed this in 99541cc Apr 29, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment