Alan D. Ayers Posted August 18, 2006 Share Posted August 18, 2006 I want to read the group and see who is in it. I already have the code to add users to my SQL Server database so all I need to do is see if they should be in SQL by getting what users are in the Group. Any help is greatly appreciated. Thanks Alan Link to comment Share on other sites More sharing options...
lod3n Posted August 18, 2006 Share Posted August 18, 2006 Here you go. The only tricky thing is that you have to know the DN (distinguished name) of the group you're trying to enumerate, in this case I'm using "cn=Administrators,cn=Builtin, " ; Bind to Active Directory; $objRootDSE = ObjGet("LDAP://RootDSE") $strDNSDomain = $objRootDSE.Get("DefaultNamingContext") ; Get the Builtin Administrators group $strContainer = "cn=Administrators,cn=Builtin, " $objGroup = ObjGet ("LDAP://"& $strContainer & $strDNSDomain) $objGroup.getInfo() $adminlist = "" $arrMemberOf = $objGroup.GetEx("member") For $strMember in $arrMemberOf $user = ObjGet ("LDAP://"&$strMember) if isobj($user) Then $adminlist &= $user.sAMAccountName & @crlf Next msgbox(0,"Admin List",$adminlist) [font="Fixedsys"][list][*]All of my AutoIt Example Scripts[*]http://saneasylum.com[/list][/font] Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now