[python-win32] User Info from AD

Michael Montagne mmontagne at WalkerMacy.com
Tue Jan 13 20:00:39 EST 2004


I'm trying to get a list of groups that an Active Directory user belongs to.  It is win 2000.
The .vbs function i'm trying to reproduce is:
Function CreateMemberOfObject(strDomain, strUserName)
' Given a domain name and username, returns a Dictionary
' object of groups to which the user is a member of.
'
' Inputs:
'
' strDomain - Input, NT Domain name
' strUserName - Input, NT username
'
Dim objUser, objGroup
 
Set CreateMemberOfObject = CreateObject("Scripting.Dictionary")
CreateMemberOfObject.CompareMode = vbTextCompare
Set objUser = GetObject("WinNT://" & strDomain & "/" & strUserName & ",user")
For Each objGroup In objUser.Groups
CreateMemberOfObject.Add objGroup.Name, "-"
Next
Set objUser = Nothing
 
End Function

I'm not even really sure where to begin.  Perhaps there is an easy way?
 
-mjm
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/python-win32/attachments/20040113/9a81264e/attachment.html


More information about the Python-win32 mailing list