From: jelenicm@... Date: 2006-03-28T04:53:55+09:00 Subject: Re: WIN32OLE heartburn Please see: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wmisdk/wmi/writing_wmi_scripts_in_jscript.asp require 'win32ole' HKLM = 0x80000002 computer = "." reg = WIN32OLE.connect("winmgmts://#{computer}/root/default:StdRegProv") in_params = reg.Methods_("EnumKey").inParameters.SpawnInstance_() in_params["hDefKey"] = HKLM in_params["sSubKeyName"] = 'Software\Microsoft\Windows\Currentversion\Uninstall' out_params = reg.ExecMethod_("EnumKey",in_params) out_params.sNames.each { |key_names| puts key_names } David dave wrote: > Hi, > > After using WIN32OLE, I have been having trouble using WMI to create a > objWMIService object. > 1) > locator = WIN32OLE.new("WbemScripting.SWbemLocator") > mgmt = locator.ConnectServer computer, '/root/default:StdRegProv', > login, password > 2) > mgmt = > WIN32OLE.connect("winmgmts:\\\\#{computer}/root/default:StdRegProv") > > I think these two methods should be equivalent objects, however the > first method is missing several internal structures like EnumKey. The > second method does contain EnumKey, but I can not login with an > impersonation. If anyone had any ideas I would appreciate them. > > dave > > -- > Posted via http://www.ruby-forum.com/.