Registry_data_exists? Proper Example for use case

#1

Community,

I need to use this module, but I don't really understand based off of whats provided how to use it. Basically i need it to create the registry key if it does not exist. Currently I am using the following code to modify the values:

registry_key "HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\SecurityProviders\\SCHANNEL\\Protocols\\TLS 1.1\\Client" do
      values [{ name: "DisabledByDefault", type: :dword, data: 1},
              { name: "Enabled", type: :dword, data: 0}]
      action :create
    end

The problem is that I get the following error:

 * Intermediate keys missing but recursive is set to false
 ================================================================================
 Error executing action `create` on resource 'registry_key[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\SSL 3.0\Client]'
 ================================================================================

 Chef::Exceptions::Win32RegNoRecursive
 -------------------------------------
 Intermediate keys missing but recursive is set to false

 Resource Declaration:
 ---------------------
 # In c:/chef/cache/cookbooks/reg_hardening_windows/recipes/default.rb

  21:     registry_key "HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\SecurityProviders\\SCHANNEL\\Protocols\\SSL 3.0\\Client" do
  22:       values [{ name: "DisabledByDefault", type: :dword, data: 1},
  23:               { name: "Enabled", type: :dword, data: 0}]
  24:       action :create
  25:     end
  26

Am I headed in the right direction by trying to use, "registry_data_exists?"

0 Likes