hallo mal wieder
folgendes ding. Ich lese alle OUs eines ADs aus.
Spoiler anzeigen
#NoTrayIcon
#include <GUIConstants.au3>
#include <GuiTreeView.au3>
GUICreate ("User erstellen", "1024","560")
GUISetState (@SW_SHOW)
Const $ADS_SCOPE_SUBTREE = 2
$logondomain = "put"
$LogonDNS = "local"
$objConnection = ObjCreate("ADODB.Connection")
$objCommand = ObjCreate("ADODB.Command")
$objConnection.Provider = "ADsDSOObject"
$objConnection.Open ("Active Directory Provider")
$objCommand.ActiveConnection = $objConnection
$objCommand.Properties("Page Size") = 1000
$objCommand.Properties("Searchscope") = $ADS_SCOPE_SUBTREE
$objCommand.CommandText = "SELECT ADsPath FROM 'LDAP://dc="&$logondomain&",dc="&$LogonDNS&"' WHERE " & "objectCategory='organizationalUnit'"
[/autoit] [autoit][/autoit] [autoit]$objRecordSet = $objCommand.Execute
[/autoit] [autoit][/autoit] [autoit]$objRecordSet.MoveFirst()
[/autoit] [autoit][/autoit] [autoit]$treeview = GUICtrlCreateTreeView (0,0,1024,100,BitOr($TVS_HASBUTTONS,$TVS_HASLINES,$TVS_LINESATROOT,$TVS_DISABLEDRAGDROP,$TVS_SHOWSELALWAYS),$WS_EX_CLIENTEDGE)
[/autoit] [autoit][/autoit] [autoit]do
$OUtree_2 = GUICtrlCreateTreeViewItem ($objRecordSet.Fields("ADsPath").Value,$treeview)
GUICtrlSetImage(-1, "shell32.dll", 3)
until $objRecordSet.MoveNext() Or $objRecordSet.EOF()
While 1
$msg = GUIGetMsg()
Switch $msg
Case $GUI_EVENT_CLOSE
ExitLoop
EndSwitch
wend
Die Ausgabe sieht dann z.B. so aus:
LDAP://OU=test,DC=PUT,DC=LOCAL
LDAP://OU=test1,OU=test,DC=PUT,DC=LOCAL
so nun sehen wir ja das test1 eine unterou von test ist. wie erkläre ich ihm nun das er da ein + macht (wies halt im AD ausschaut). Ist meine Abfrage falsch oder kann man dieses irgendwie sortieren bzw. erkennen lassen.
thx
Edit BugFix: Spoiler eingefügt