Hi Tinu,

On Thu, Jul 25, 2013 at 8:04 AM, tinu <tinu.walt...@gmail.com> wrote:

> I should read the values of some registry keys like
> 'HKLM\SOFTWARE\Puppet\WCM\Initial_Setup'.
>
> How can I do this?
>
> Thanx
>
> Tinu
>
> --
> You received this message because you are subscribed to the Google Groups
> "Puppet Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to puppet-users+unsubscr...@googlegroups.com.
> To post to this group, send email to puppet-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/puppet-users.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

Something like this should work:

require 'win32/registry'

Win32::Registry::HKEY_LOCAL_MACHINE.open(*'*SOFTWARE\Puppet\WCM\Initial_Setup')
do |reg|
  value = reg['foo']
end

Note win32/registry is part of the ruby stdlib:
http://ruby-doc.org/stdlib-1.9.3/libdoc/dl/rdoc/Win32/Registry.html

There are also methods to read values as REG_DWORD, REG_EXPAND_SZ, etc.

Josh

-- 
Josh Cooper
Developer, Puppet Labs

*Join us at PuppetConf 2013, August 22-23 in San Francisco - *
http://bit.ly/pupconf13*
**Register now and take advantage of the Final Countdown discount - save
15%!*

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to puppet-users+unsubscr...@googlegroups.com.
To post to this group, send email to puppet-users@googlegroups.com.
Visit this group at http://groups.google.com/group/puppet-users.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to