Hi all,

Ruby 1.8.2
Windows XP

Are there any known issues with using associators and win32ole?
Consider the following example.  Using the first query below, I get four
rows back that look like this:

"\\\\MYDOMAIN\\root\\cimv2:Win32_UserAccount.Domain=\"MYDOMAIN\",Name=\"
System Account\""
"\\\\MYDOMAIN\\root\\cimv2:Win32_Group.Domain=\"AD\",Name=\"Domain
Admins\""
"\\\\MYDOMAIN\\root\\cimv2:Win32_Group.Domain=\"AD\",Name=\"Desktop
Admins\""
"\\\\MYDOMAIN\\root\\cimv2:Win32_UserAccount.Domain=\"AD\",Name=\"djberg
e\""

However, I'd like to get back the actual Win32_UserAccount objects
instead of plain strings.  When I try to use associators, I get no
results.  What am I doing wrong?

Thanks.

Dan

# assoctest.rb
require "win32ole"
require "socket"

host = Socket.gethostname

cs = "winmgmts://#{host}/root/cimv2"

# For local groups, you probably want to replace 'MYDOMAIN' with your
host name.

# This returns partcomponent as a String
query = "
   SELECT *
   FROM Win32_GroupUser
   WHERE
groupcomponent=\"Win32_Group.Domain='MYDOMAIN',Name='Administrators'\"
"

# This should return partcomponent as a Win32_UserAccount object, but
instead returns nothing
#query = "
#   associators of {Win32_Group.Domain='MYDOMAIN',
Name='Administrators'}
#   where resultclass = Win32_UserAccount AssocClass = Win32_GroupUser
#"

wmi = WIN32OLE.connect(cs)
wmi.execquery(query).each{ |m|
   p m.partcomponent
}