Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Ruby > WIN32OLE heartburn

Reply
Thread Tools

WIN32OLE heartburn

 
 
David dave
Guest
Posts: n/a
 
      03-27-2006
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/.


 
Reply With Quote
 
 
 
 
jelenicm@gmail.com
Guest
Posts: n/a
 
      03-27-2006
Please see:
http://msdn.microsoft.com/library/de...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\Uninsta ll'
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/.


 
Reply With Quote
 
 
 
 
David dave
Guest
Posts: n/a
 
      03-27-2006

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

--
Posted via http://www.ruby-forum.com/.


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
WIN32OLE - failed to create WIN32OLE zxem Ruby 1 12-19-2007 07:01 PM
WIN32OLE#[] and WIN32OLE#[]= method in Ruby 1.9 (or later) Masaki Suketa Ruby 4 03-27-2006 11:17 AM
Compiled win32ole 0.5.3? Chris Morris Ruby 4 07-22-2003 05:45 AM
[WIN32OLE]: Using Events Steve Tuckner Ruby 0 07-07-2003 10:15 PM
[WIN32OLE] Outlook Automation Question Steve Tuckner Ruby 0 06-26-2003 03:54 PM



Advertisments