godofpray Posted April 30, 2008 Posted April 30, 2008 (edited) Hi is it possible to browse the active directory an pick a group into a variable? i could not find any solution for this. regards Edited April 30, 2008 by godofpray
Developers Jos Posted April 30, 2008 Developers Posted April 30, 2008 (edited) Hiis it possible to browse the active directory an pick a group into a variable? i could not find any solution for this. regardsNot sure what you are asking but there are several scripts/udfs posted that will work with AD users/groups using the ADSI LDAP/WINNT Com objects.Jos Edited April 30, 2008 by Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past.
godofpray Posted April 30, 2008 Author Posted April 30, 2008 Not sure what you are asking but there are several scripts/udfs posted that will work with AD users/groups using the ADSI/WINNT Com objects.JosHi Josi will manually pick an existing group name from ad into a variable. like this: open ad window, search an mark the group, ok and then the group is in a variable.i could not find any reason in the forum.regards
Developers Jos Posted April 30, 2008 Developers Posted April 30, 2008 (edited) This is an example of a script that enumerates all users and write them to a file, maybe that gives you an Idea how to start coding your script. I have no domain to my disposal anymore thus cannot test and change it to show groups. Func _EnumUsers() Local $objCommand = ObjCreate("ADODB.Command") Local $objConnection = ObjCreate("ADODB.Connection") $objConnection.Provider = "ADsDSOObject" $objConnection.Open ("Active Directory Provider") $objCommand.ActiveConnection = $objConnection Local $strBase = "<GC://dc=MyDom,dc=Inc>" Local $strFilter = "(&(objectCategory=person)(objectClass=user)(sAMAccountName=*))" Local $strAttributes = "cn,sAMAccountName,displayName,sn,distinguishedName" Local $strQuery = $strBase & ";" & $strFilter & ";" & $strAttributes & ";subtree" $objCommand.CommandText = $strQuery $objCommand.Properties ("Page Size") = 100 $objCommand.Properties ("Timeout") = 30 $objCommand.Properties ("Cache Results") = False $ADS_SCOPE_SUBTREE = 2 $objCommand.Properties ("searchscope") = $ADS_SCOPE_SUBTREE Local $objRecordSet = $objCommand.Execute While Not $objRecordSet.EOF ;~ $strName = $objRecordSet.Fields ("sAMAccountName").Value ;~ $strCN = $objRecordSet.Fields ("cn").value ;~ $strdisplayName = $objRecordSet.Fields ("displayName").value ;~ $strSN = $objRecordSet.Fields ("SN").value ;~ $strdistinguishedName = $objRecordSet.Fields ("distinguishedName").value ;~ $strSID = $objRecordSet.Fields ("distinguishedName").value FileWriteLine("Users.txt",$objRecordSet.Fields ("sAMAccountName").Value) $objRecordSet.MoveNext WEnd $objConnection.Close $objConnection = "" $objCommand = "" $objRecordSet = "" EndFunc ;==>_EnumUsers Edited April 30, 2008 by Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past.
godofpray Posted April 30, 2008 Author Posted April 30, 2008 thank you what i am searching for is a funktion like this, but not for files, for active directory. $blabla = FileSelectFolder("Pick Folder", "")
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