WIN32OLE heartburn

Discussion in 'Ruby' started by David dave, Mar 27, 2006.

  1. David dave

    David dave Guest

    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/.
     
    David dave, Mar 27, 2006
    #1
    1. Advertising

  2. David dave

    Guest

    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 }


    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/.
     
    , Mar 27, 2006
    #2
    1. Advertising

  3. David dave

    David dave Guest

    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/.
     
    David dave, Mar 27, 2006
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Steve Tuckner

    [WIN32OLE] Outlook Automation Question

    Steve Tuckner, Jun 26, 2003, in forum: Ruby
    Replies:
    0
    Views:
    203
    Steve Tuckner
    Jun 26, 2003
  2. Steve Tuckner

    [WIN32OLE]: Using Events

    Steve Tuckner, Jul 7, 2003, in forum: Ruby
    Replies:
    0
    Views:
    172
    Steve Tuckner
    Jul 7, 2003
  3. Chris Morris

    Compiled win32ole 0.5.3?

    Chris Morris, Jul 19, 2003, in forum: Ruby
    Replies:
    4
    Views:
    135
    Shusaku
    Jul 22, 2003
  4. Masaki Suketa
    Replies:
    4
    Views:
    400
    Dave Burt
    Mar 27, 2006
  5. zxem
    Replies:
    1
    Views:
    253
Loading...

Share This Page