[python-win32] Win32_GroupUser

Tim Golden mail at timgolden.me.uk
Mon Nov 13 20:32:31 CET 2006


Tim Roberts <timr <at> probo.com> writes:

> 
> Tim Golden wrote:
> > | Working off a large-ish domain, I can't seem to find a form of:
> > | 
> > | import wmi
> > | conn = wmi.WMI ()
> > | stuff = conn.Win32_GroupUser ()
> > | 
> > | ... that doesn't enumerate the entire domain.
> >
> > I'm going to assume that you didn't intend the
> > double-negative in the above. 
> >   
> 
> Actually, I think he did.  Everything he tried enumerated the entire
> domain, which is not what he wanted.  He wanted to query a subset only.

Ah yes, my misunderstanding. Thanks for pointing out.

> What he posted was:
> 
> conn.Win32_GroupUser (GroupComponent = "Win32_Group.SID=sid_number")
> 
> Suggesting, perhaps, that he wanted only the users within 
> a group with a given SID.

I imagine you're right. Hopefully my example gave
a way of doing that, but I'll just repost slightly
here:

<code>
import wmi
c = wmi.WMI ()
sid_number = "whatever"
group = c.Win32_Group (SID=sid_number)
#
# and then as before, using group.associators (...)
#

</code>

TJG



More information about the Python-win32 mailing list