[chef] Read windows registry Key values


Chronological Thread 
  • From: Sachin Gupta < >
  • To: " " < >
  • Cc: sachin kumar < >
  • Subject: [chef] Read windows registry Key values
  • Date: Fri, 27 Feb 2015 00:23:51 +0530

Hi All,

I am working on a use case where I need to read two registry key values and compare there data in a recipe

HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\ComputerName\\ActiveComputerName

HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\ComputerName\\ComputerName

both are having a value name(ComputerName) and value data(may be same or different). I need to compare there value data.

Do I need to write like this:; or some other better way??

Win32::Registry::HKEY_LOCAL_MACHINE.open(keynameComp, access) do |reg|
reg.each{|name, value, keys | compName = keys}
end
Win32::Registry::HKEY_LOCAL_MACHINE.open(keynameActive, access) do |reg|
reg.each{|name, value, keys | compNameActive = keys}
end


Any idea??


Thanks & Regards,
Sachin Gupta



Archive powered by MHonArc 2.6.16.

§