WIN32OLE heartburn

D

David dave

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
 
J

jelenicm

Please see:
http://msdn.microsoft.com/library/d...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 }
 
D

David dave

Thank you for the reply. Is there another way to reach a remote
registry and use impersonation? I am not sure how to login under a
different user given your example.
dave
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,764
Messages
2,569,565
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top