Wednesday, August 19, 2009

How to change a registry key using Ruby

Here is how you can do it :-

For example, I am setting the enablesecuritysignature DWord key to 1

require 'win32/registry.rb'

Win32::Registry::HKEY_LOCAL_MACHINE.open('SYSTEM\CurrentControlSet\Services\lanmanserver\parameters', Win32::Registry::KEY_WRITE) do |reg|
reg['enablesecuritysignature',Win32::Registry::REG_DWORD] = '1'
end



No comments: