[python-win32] Win32_GroupUser
Tim Golden
Tim.Golden at viacom-outdoor.co.uk
Mon Nov 13 18:11:09 CET 2006
| Has anyone had any successes with Tim Golden's wmi module and
| the somewhat evil Win32_GroupUser WMI object?
Well I can't say that I had, but I started to look
around when you asked and there do seem to be a few
caveats:
1) Win32_GroupUser is an association between Win32_Group and
Win32_Account,
just in case you didn't realise.
2) There's a warning here: http://support.microsoft.com/kb/302857
which suggests that it's less than optimal because of what
happens behind the scenes. [But that seems to apply only to
NT4 & early Win2K]
| 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.
3) I suggest that the easiest way to use it is this following:
<code>
import wmi
c = wmi.WMI ()
sql_group = c.Win32_Group (Name="SQL_Adminstrators")
sql_users1 = sql_group.associators (wmi_result_class="Win32_Account")
# or, if you prefer
sql_users2 = sql_group.associators
(wmi_association_class="Win32_GroupUser")
</code>
But that doesn't answer your question. I ran that against
my domain and returned all 15 users in that particular group,
albeit after about a minute or something. I'm running it
against our Domain Users group now...
... and that came back with 726 (after about 2 minutes)
which, my sysadmins tell me, is about the right number.
Can you post a specific bit of code, just so I can
see what you're doing, and indicate how many users
you're expecting to get back and how many you actually
get?
Thanks
TJG
________________________________________________________________________
This e-mail has been scanned for all viruses by Star. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:
http://www.star.net.uk
________________________________________________________________________
More information about the Python-win32
mailing list