Jump to content

uruloke

Members
  • Posts

    8
  • Joined

  • Last visited

Everything posted by uruloke

  1. I did an edit and post my solution on the first post muttley
  2. Hi! Here is the function I wrote for getting recursively all the parents! muttley You only have to call GetItemAdsPath Func GetItemAdsPath ($hTreeView) Local $Text, $hItem, $hParentItem ; Get Item ID $hItem = _GUICtrlTreeView_GetSelection ($hTreeView) If $hItem <> 0 Then $Text = GetItemRecursiveAdsPath ($hTreeView, $hItem) EndIf Return $Text EndFunc Func GetItemRecursiveAdsPath ($hTreeView, $hItem) Local $Text, $hParentItem ; Get Parent Item ID $hParentItem = _GUICtrlTreeView_GetParentHandle($hTreeView, $hItem) If $hParentItem=0 Then $Text = "OU="&_GUICtrlTreeView_GetText ($hTreeView, $hItem) Else $Text = "OU="&_GUICtrlTreeView_GetText ($hTreeView, $hItem) & "," & GetItemRecursiveAdsPath ($hTreeView, $hParentItem) EndIf Return $Text EndFunc
  3. Thank you! I tried with this function before, but i guess i used wrong parameters anyway, now it works muttley
  4. Hi, maybe my question is stupid, but i don't find the answer... I want to put my treeview creation in a function. I wrote the following code: #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <TreeViewConstants.au3> #include <StaticConstants.au3> #Include <GuiTreeView.au3> GUICreate("AD TreeView", 400, 400) $treeviewID = CreateADTree (25, 25, 300, 300, BitOr($TVS_HASBUTTONS, $TVS_HASLINES, $TVS_LINESATROOT, $TVS_DISABLEDRAGDROP, $TVS_SHOWSELALWAYS), $WS_EX_CLIENTEDGE) $treeview = GUICtrlGetHandle ($treeviewID) $infobutton = GUICtrlCreateButton("Info", 25, 350, 70, 20, 0) $cancelbutton = GUICtrlCreateButton("Cancel", 125, 350, 70, 20, 0) GUISetState () While 1 $msg = GUIGetMsg() Select Case $msg = $cancelbutton Or $msg = $GUI_EVENT_CLOSE ExitLoop Case $msg = $infobutton $item = GUICtrlRead($treeview) ; Get the controlID of the current selected treeview item If $item = 0 Then MsgBox(64, "TreeView Demo", "No item currently selected") Else _GUICtrlTreeView_SelectItem($treeview, $item) ;MsgBox(4160, "Information", "Parent Handle: " & _GUICtrlTreeView_GetParentHandle($treeview, $item)) ;MsgBox(4160, "Information", "Parent ID: " & _GUICtrlTreeView_GetParentParam($treeview, $item)) $ParentID = _GUICtrlTreeView_GetParentParam($treeview, $item) $ParentText = GUICtrlRead($ParentID, 1) ;_GUICtrlTreeView_SelectItem($treeview, _GUICtrlTreeView_GetParentHandle($treeview, $item)) $text = GUICtrlRead($item, 1); Get the text of the treeview item If $text == "" Then MsgBox(16, "Error", "Error while retrieving infos about item") Else MsgBox(64, "TreeView Demo", "Parent Text is : "& $ParentText &" and Current item selected is: " & $text) EndIf EndIf EndSelect WEnd GUIDelete() Exit Func CreateADTree ($intLeft, $intTop, $intWidth, $intHeight, $intStyle, $intExStyle ) Local $LocalTreeview $LocalTreeview = GUICtrlCreateTreeView($intLeft, $intTop, $intWidth, $intHeight, $intStyle, $intExStyle) $hImage = _GUIImageList_Create(16, 16, 5, 3) $hFolderImage = _GUIImageList_AddIcon($hImage, "shell32.dll", 4) _GUICtrlTreeView_SetNormalImageList($LocalTreeview, $hImage) _GUICtrlTreeView_BeginUpdate($LocalTreeview) $RootNode = _GUICtrlTreeView_Add($LocalTreeview, 0, "ROOT NODE", $hFolderImage, $hFolderImage) _GUICtrlTreeView_AddChild($LocalTreeview, $RootNode, "DO 1",$hFolderImage, $hFolderImage) $DO2 = _GUICtrlTreeView_AddChild($LocalTreeview, $RootNode, "DO 2", $hFolderImage, $hFolderImage) _GUICtrlTreeView_AddChild($LocalTreeview, $DO2, "Sub 1",$hFolderImage,$hFolderImage) _GUICtrlTreeView_AddChild($LocalTreeview, $DO2, "Sub 2",$hFolderImage,$hFolderImage) _GUICtrlTreeView_AddChild($LocalTreeview, $DO2, "Sub 3",$hFolderImage,$hFolderImage) _GUICtrlTreeView_AddChild($LocalTreeview, $DO2, "Sub 4",$hFolderImage,$hFolderImage) _GUICtrlTreeView_AddChild($LocalTreeview, $RootNode, "DO 3",$hFolderImage, $hFolderImage) _GUICtrlTreeView_AddChild($LocalTreeview, $RootNode, "DO 4",$hFolderImage, $hFolderImage) _GUICtrlTreeView_EndUpdate($LocalTreeview) Return $LocalTreeview EndFunc Well, my treeview is created, but i cannot get the selected item!! Have you some function to get the texte/name of the selected node ? I'm not sure i'm using the best way... Thank you very much!!
  5. Hi! Thx for your answer, i looked for these user defined functions, and it seems i can use it for what i'm looking for! I will test it next week, and post here my solution if it works muttley
  6. Hi, thx Bert for your help. I'm thinking i maybe wrote a bad title for my topic, because my main problem is treeview, not Active Directory (maybe some moderator can change it for "Treeview : Advances Features?? / use for AD browsing" ?) Anyway, if i take 2 minutes to think about it, i think i can solve my problem if someone can give me a solution/exemple for the following issue: I want to obtain the following treeview: ------------------------------- [MyTree] +NodeA + nA_Sub1 - nASubSub1 - nA_Sub2 +NodeB - nB_Sub1 +NodeC ------------------------------- And a way / a function to obtain one (or both I you can) of the following information, when I Click and select the node "nASubSub1": 1/ result = "nASubSub1 / nA_Sub1 / NodeA" (or NodeA / nA_Sub1 / nASubSub1) 2/ result = "My Hidden Value for nASubSub1"
  7. Yes, exactly, the tree part (on the left pane) If I keep your exemple: suppose I wanna create a computer in the OU "student pc lab #1". 1/ I have a script/function who takes the OU path in parameter (to know where i will create the computer object) 2/ I want to keep the "AD tree" looklike: I click on "student pc lab #1" to specify the target OU. 3/ I need to get the OU path from the selected node to use it with my function createComputerObject
  8. Hello, i'm a new user of AutoIt, but i decided to use it because it seems really great to get awesome GUI for my vbscripts Anyway, I want to make an Active Directory Treeview (look like ADUC console) to run customs scripts to performs creations, search, etc.. Reading the help file of AutoIt, I found a way to create a treeview, and i'm pretty sure i can use my brain to find a way to dynamicaly create nodes from my AD. But there something i have not found (I promise I made a search on the forum before posting) : I need a way to get the full path (to have the Distinguished Name in AD) of the selected node. The only thing I found is how to get the name of the node with GUICtrlRead($menu1, 1) So, my questions are: - how can i have the name of the parent node ? With this info, i could recursively build the full path - Is it possible to set a hidden value on a node? In this case I could set the Distinguished Name in the value, and the treeview will only show the name (i'm not sure to be clear muttley ) Anyway, if someone as already made an AD treeview / browser, I would be happy to get it Thank you very much ----------------------------------- EDIT : SCRIPT SOLUTION ----------------------------------- Hi! Here I give you my GenerateADTreeview v1 It makes queries in Active Directory to build the treeview For now, you have to specify a root Organizationnal Unit (in the MAIN part, modify $strRootContainer) to make it work! You won't see User or Computers container for exemple #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <TreeViewConstants.au3> #include <StaticConstants.au3> #Include <GuiTreeView.au3> Opt('MustDeclareVars', 1) #region ; Define AD Constants Global Const $ADS_GROUP_TYPE_GLOBAL_GROUP = 0x2 Global Const $ADS_GROUP_TYPE_DOMAIN_LOCAL_GROUP = 0x4 Global Const $ADS_GROUP_TYPE_UNIVERSAL_GROUP = 0x8 Global Const $ADS_GROUP_TYPE_SECURITY_ENABLED = 0x80000000 Global Const $ADS_GROUP_TYPE_GLOBAL_SECURITY = BitOR($ADS_GROUP_TYPE_GLOBAL_GROUP, $ADS_GROUP_TYPE_SECURITY_ENABLED) Global Const $ADS_GROUP_TYPE_UNIVERSAL_SECURITY = BitOR($ADS_GROUP_TYPE_UNIVERSAL_GROUP, $ADS_GROUP_TYPE_SECURITY_ENABLED) Global Const $ADS_GROUP_TYPE_DOMAIN_LOCAL_SECURITY = BitOR($ADS_GROUP_TYPE_DOMAIN_LOCAL_GROUP, $ADS_GROUP_TYPE_SECURITY_ENABLED) Global Const $ADS_UF_PASSWD_NOTREQD = 0x0020 Global Const $ADS_UF_WORKSTATION_TRUST_ACCOUNT = 0x1000 Global Const $ADS_ACETYPE_ACCESS_ALLOWED = 0x0 Global Const $ADS_ACETYPE_ACCESS_ALLOWED_OBJECT = 0x5 Global Const $ADS_FLAG_OBJECT_TYPE_PRESENT = 0x1 Global Const $ADS_RIGHT_GENERIC_READ = 0x80000000 Global Const $ADS_RIGHT_DS_SELF = 0x8 Global Const $ADS_RIGHT_DS_WRITE_PROP = 0x20 Global Const $ADS_RIGHT_DS_CONTROL_ACCESS = 0x100 Global Const $ADS_UF_ACCOUNTDISABLE = 2 Global Const $ADS_OPTION_SECURITY_MASK = 3 Global Const $ADS_SECURITY_INFO_DACL = 4 Global Const $ADS_PROPERTY_CLEAR = 1 Global Const $ADS_PROPERTY_APPEND = 3 Global Const $ADS_SCOPE_ONELEVEL = 1 Global Const $ADS_SCOPE_SUBTREE = 2 Global Const $ALLOWED_TO_AUTHENTICATE = "{68B1D179-0D15-4d4f-AB71-46152E79A7BC}" Global Const $RECEIVE_AS = "{AB721A56-1E2f-11D0-9819-00AA0040529B}" Global Const $SEND_AS = "{AB721A54-1E2f-11D0-9819-00AA0040529B}" Global Const $USER_CHANGE_PASSWORD = "{AB721A53-1E2f-11D0-9819-00AA0040529b}" Global Const $USER_FORCE_CHANGE_PASSWORD = "{00299570-246D-11D0-A768-00AA006E0529}" Global Const $USER_ACCOUNT_RESTRICTIONS = "{4C164200-20C0-11D0-A768-00AA006E0529}" Global Const $VALIDATED_DNS_HOST_NAME = "{72E39547-7B18-11D1-ADEF-00C04FD8D5CD}" Global Const $VALIDATED_SPN = "{F3A64788-5306-11D1-A9C5-0000F80367C1}" Const $Member_SchemaIDGuid = "{BF9679C0-0DE6-11D0-A285-00AA003049E2}" Global $objConnection = ObjCreate("ADODB.Connection") ; Create COM object to AD $objConnection.ConnectionString = "Provider=ADsDSOObject" $objConnection.Open ("Active Directory Provider") ; Open connection to AD Global $objRootDSE = ObjGet("LDAP://RootDSE") Global $strAdsDomainPath = $objRootDSE.Get ("defaultNamingContext") ; Retrieve the current AD domain name Global $strHostServer = $objRootDSE.Get ("dnsHostName"); Retrieve the name of the connected DC Global $strConfiguration = $objRootDSE.Get ("ConfigurationNamingContext"); Retrieve the Configuration naming context #endregion #region ; Define Script Constants Global Const $ADS_SCOPE_DEPTH = 1 #endregion ;********************************************************************** ; MAIN ;********************************************************************** Global $hTreeView Global $strRootContainer = "OU=TESTS" &","& $strAdsDomainPath Local $infobutton, $cancelbutton, $msg, $Text GUICreate("AD TreeView", 400, 400) $hTreeView = CreateADTree ($strRootContainer, 25, 25, 300, 300, BitOr($TVS_HASBUTTONS, $TVS_HASLINES, $TVS_LINESATROOT, $TVS_DISABLEDRAGDROP, $TVS_SHOWSELALWAYS), $WS_EX_CLIENTEDGE) $infobutton = GUICtrlCreateButton("Info", 25, 350, 70, 20, 0) $cancelbutton = GUICtrlCreateButton("Cancel", 125, 350, 70, 20, 0) GUISetState () GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY") While 1 $msg = GUIGetMsg() Select Case $msg = $cancelbutton Or $msg = $GUI_EVENT_CLOSE ExitLoop Case $msg = $infobutton $Text = GetItemAdsPath ($hTreeView) MsgBox(64, "Information", $Text) EndSelect WEnd GUIDelete() Exit #region ;********************************************************************** ; FONCTIONS ;********************************************************************** #region ; TreeView Functions ; --------------------------------------------------------------------- ; Create Treeview of OrganizationalUnits by queries in Active Directory ; --------------------------------------------------------------------- Func CreateADTree ($strRootAdsPath, $intLeft, $intTop, $intWidth, $intHeight, $intStyle, $intExStyle ) Local $LocalTreeview, $RootNode, $strRootName Global $hImage, $hFolderImage $LocalTreeview = GUICtrlCreateTreeView($intLeft, $intTop, $intWidth, $intHeight, $intStyle, $intExStyle) $hImage = _GUIImageList_Create(16, 16, 5, 3) $hFolderImage = _GUIImageList_AddIcon($hImage, "shell32.dll", 4);Folder Image _GUICtrlTreeView_SetNormalImageList($LocalTreeview, $hImage) _GUICtrlTreeView_BeginUpdate($LocalTreeview) $strRootName = GetObjectInfo ($strRootAdsPath, "Name") $RootNode = _GUICtrlTreeView_Add($LocalTreeview, 0, $strRootName, $hFolderImage, $hFolderImage) BuildADtreeView ($LocalTreeview, $RootNode, $strRootAdsPath,$ADS_SCOPE_DEPTH) _GUICtrlTreeView_EndUpdate($LocalTreeview) Return $LocalTreeview EndFunc ; --------------------------------------------------------------------- ; Fonction récursive à N niveaux créant des noeuds à partir de requetes AD ; $intDepth = number of recursive calls ; --------------------------------------------------------------------- Func BuildADtreeView ($hTreeView, $hItem, $strAdsContainer,$intDepth) Local $strOrganizationalUnitsDN, $arrOUsList, $intSizeArray Local $strObjectDN, $strObjectName Local $ThisItem, $i If $intDepth < 1 Then Return EndIf $strOrganizationalUnitsDN = QueryAD ($strAdsContainer, $ADS_SCOPE_ONELEVEL,"OrganizationalUnit", "DistinguishedName", "name", "=", "*", "name") $arrOUsList = StringSplit($strOrganizationalUnitsDN,";") $intSizeArray = $arrOUsList[0] If $strOrganizationalUnitsDN = "" Then ;ConsoleWrite("LISTOU > EXIT FUNC "&@LF) Else For $i = 1 To $intSizeArray $strObjectDN = $arrOUsList[$i] $strObjectName = GetObjectInfo($strObjectDN, "name") ; Add Item on Treeview $ThisItem = _GUICtrlTreeView_AddChild($hTreeView, $hItem, $strObjectName, $hFolderImage, $hFolderImage) ; Build Sub Containers If ($intDepth-1) > 0 Then BuildADtreeView ($hTreeView, $ThisItem, $strObjectDN,$intDepth-1) EndIf Next EndIf EndFunc ; --------------------------------------------------------------------- ; Control clicks on Treeview ; --------------------------------------------------------------------- Func WM_NOTIFY($hWnd, $iMsg, $iwParam, $ilParam) #forceref $hWnd, $iMsg, $iwParam Local $hWndFrom, $iIDFrom, $iCode, $tNMHDR, $hWndTreeview $hWndTreeview = $hTreeView If Not IsHWnd($hTreeView) Then $hWndTreeview = GUICtrlGetHandle($hTreeView) $tNMHDR = DllStructCreate($tagNMHDR, $ilParam) $hWndFrom = HWnd(DllStructGetData($tNMHDR, "hWndFrom")) $iIDFrom = DllStructGetData($tNMHDR, "IDFrom") $iCode = DllStructGetData($tNMHDR, "Code") Switch $hWndFrom Case $hWndTreeview Switch $iCode Case $NM_CLICK; The user has clicked the left mouse button within the control Local $tPoint, $tTVHEx, $TVhItem, $mX, $mY $tPoint = _WinAPI_GetMousePos(True, $hWndTreeview) $mX = DllStructGetData($tPoint, "X") $mY = DllStructGetData($tPoint, "Y") $tTVHEx = _GUICtrlTreeView_HitTestEx($hWndTreeview, $mX, $mY) $TVhItem = DllStructGetData($tTVHEx, "Item") Switch DllStructGetData($tTVHEx, "Flags") Case $TVHT_ONITEM ConsoleWrite("$NM_CLICK" & @LF & "--> $TVHT_ONITEM Item Handle:" & @TAB & $TVhItem) Case $TVHT_ONITEMLABEL or $TVHT_ONITEMICON TreeView_RefreshItem ($hTreeView, $TVhItem) EndSwitch ;~ Return 1; nonzero to not allow the default processing Return 0; zero to allow the default processing EndSwitch EndSwitch Return $GUI_RUNDEFMSG EndFunc ;==>WM_NOTIFY ; --------------------------------------------------------------------- ; Refresh : Load Sub Containers (query AD) ; --------------------------------------------------------------------- Func TreeView_RefreshItem ($hTreeView, $hItem) Local $strItemAdsPath, $intNbChildren Local $strAdsContainer $strItemAdsPath = GetItemRecursiveAdsPath ($hTreeView, $hItem) $intNbChildren = _GUICtrlTreeView_GetChildCount($hTreeView, $hItem) If $intNbChildren < 0 Then $strAdsContainer = $strItemAdsPath & "," &$strAdsDomainPath BuildADtreeView ($hTreeView, $hItem, $strAdsContainer,$ADS_SCOPE_DEPTH) EndIf EndFunc ; --------------------------------------------------------------------- ; TreeView Function : Get Selected Item's Label ; --------------------------------------------------------------------- Func GetItemText ($hTreeView) Local $hItem, $Text $hItem = _GUICtrlTreeView_GetSelection ($hTreeView) ;MsgBox(64, "Information", $hItem) If $hItem = 0 Then $Text = "No item currently selected" Else $Text = _GUICtrlTreeView_GetText ($hTreeView, $hItem) EndIf Return $Text EndFunc ; --------------------------------------------------------------------- ; TreeView Function : Get Parent's Label of the Selected Item ; --------------------------------------------------------------------- Func GetParentItemText ($hTreeView) Local $hItem, $Text Local $hParentItem $hItem = _GUICtrlTreeView_GetSelection ($hTreeView) If $hItem = 0 Then $Text = "No item currently selected" Else $hParentItem = _GUICtrlTreeView_GetParentHandle($hTreeView, $hItem) ;MsgBox(64, "Parent", $hParentItem) If $hParentItem=0 Then $Text = "" Else $Text = _GUICtrlTreeView_GetText ($hTreeView, $hParentItem) EndIf EndIf Return $Text EndFunc ; --------------------------------------------------------------------- ; TreeView Function : Get Selected Item's ADS Path ; syntax like OU=Temp,OU=SALES,OU=Company ; --------------------------------------------------------------------- Func GetItemAdsPath ($hTreeView) Local $Text, $hItem, $hParentItem ; Get Item ID $hItem = _GUICtrlTreeView_GetSelection ($hTreeView) If $hItem <> 0 Then $Text = GetItemRecursiveAdsPath ($hTreeView, $hItem) EndIf Return $Text EndFunc ; --------------------------------------------------------------------- ;; TreeView Function : Get Specified Item's ADS Path ; syntax like OU=Temp,OU=SALES,OU=Company ; --------------------------------------------------------------------- Func GetItemRecursiveAdsPath ($hTreeView, $hItem) Local $Text, $hParentItem ; Get Parent Item ID $hParentItem = _GUICtrlTreeView_GetParentHandle($hTreeView, $hItem) If $hParentItem=0 Then $Text = "OU="&_GUICtrlTreeView_GetText ($hTreeView, $hItem) Else $Text = "OU="&_GUICtrlTreeView_GetText ($hTreeView, $hItem) & "," & GetItemRecursiveAdsPath ($hTreeView, $hParentItem) EndIf Return $Text EndFunc #endregion #region ; AD Functions ; --------------------------------------------------------------------- ; Requete AD ; $intScope = ADS_SCOPE_ONELEVEL or ADS_SCOPE_SUBTREE ; $strTypeFilter = USER, CONTACT, GROUP, COMPUTER ; $strAttributeQueried : Attribut retourné (ex: DistinguishedName, Name, CN, etc.) ; $strAttributeRequested : Critere de recherche (ex: SamAccountName, Name, DisplayName, GivenName, etc.) ; $strOperator: operation à effectuer (ex: "=", ">", "<>") ; $strAttributeValue : requete de valeur (ex: "toto" pour le Name) ; > Recherche possible avec le wildchar (ex: Test*) ; $strSort : Critère de tri alphabétique (ex: "Name" pour un tri sur le nom) ; > Mettre à "" pour ne faire aucun tri ; SORTIE: Si plusieurs réponses, séparation par ';' (ex: DN1;DN2;DN3) ; --------------------------------------------------------------------- Func QueryAD ($strLdapRootPath, $intScope, $strTypeFilter, $strAttributeQueried, $strAttributeRequested, $strOperator, $strAttributeValue, $strSort) Local $objCommand, $objRecordSet Local $strResultQuery, $strResultQueryMultiValued Local $arrTemp, $strValue, $CleanAdsPath $strResultQuery = "" $objCommand = ObjCreate("ADODB.Command") $objCommand.ActiveConnection = $objConnection ;Escape Special Characters for SQL Query $CleanAdsPath = StringReplace($strLdapRootPath,"'","''") $CleanAdsPath = StringReplace($CleanAdsPath,"+","\+") If StringCompare($strTypeFilter,"COMPUTER")=0 Then $objCommand.CommandText = _ "Select "& $strAttributeQueried &","&$strSort&" from 'LDAP://" & $CleanAdsPath & _ "' where objectClass='COMPUTER' and "&$strAttributeRequested&"='"&$strAttributeValue&"'" Else $objCommand.CommandText = _ "Select "& $strAttributeQueried &" from 'LDAP://" & $CleanAdsPath & _ "' where objectClass='"&$strTypeFilter&"' AND objectClass<>'computer' and "&$strAttributeRequested& $strOperator &"'"&$strAttributeValue&"'" EndIf $objCommand.Properties("Page Size") = 1000; Recherche par paquet de 1000 objets $objCommand.Properties("Timeout") = 30 $objCommand.Properties("Searchscope") = $intScope $objCommand.Properties("Cache Results") = False If $strSort<>"" Then $objCommand.Properties("Sort on") = $strSort EndIf $objRecordSet = $objCommand.Execute If $objRecordSet.EOF <> true Then $objRecordSet.MoveFirst EndIf If NOT $objRecordSet.EOF Then If IsArray($objRecordSet.Fields($strAttributeQueried)) Then $arrTemp = $objRecordSet.Fields($strAttributeQueried) $strResultQueryMultiValued = "" For $strValue In $arrTemp If $strResultQueryMultiValued="" Then $strResultQueryMultiValued = $strValue Else $strResultQueryMultiValued = $strResultQueryMultiValued &"§"& $strValue EndIf Next $strResultQuery = $strResultQueryMultiValued Else $strResultQuery = $objRecordSet.Fields($strAttributeQueried).Value EndIf $objRecordSet.MoveNext EndIf ;MsgBox (1,"Query AD","$strResultQuery : "&$strResultQuery) While NOT $objRecordSet.EOF If IsArray($objRecordSet.Fields($strAttributeQueried)) Then $arrTemp = $objRecordSet.Fields($strAttributeQueried) $strResultQueryMultiValued = "" For $strValue In $arrTemp If $strResultQueryMultiValued="" Then $strResultQueryMultiValued = $strValue Else $strResultQueryMultiValued = $strResultQueryMultiValued &"§"& $strValue EndIf Next $strResultQuery = $strResultQuery &";" &$strResultQueryMultiValued Else $strResultQuery = $strResultQuery &";" &$objRecordSet.Fields($strAttributeQueried).Value EndIf $objRecordSet.MoveNext Wend $objCommand = 0 $objRecordSet = 0 Return $strResultQuery EndFunc ; --------------------------------------------------------------------- ; Récupère la valeur d'un attribut d'un objet AD ; - StrObjectDN = Object DistinguishedName ; - StrAttribute = Attribut choisi ; --------------------------------------------------------------------- Func GetObjectInfo ($strObjectDN, $strAttribute) Local $objADObject, $strResult $objADObject = ObjGet ("LDAP://"&$strObjectDN) $objADObject.GetInfo $strResult = $objADObject.Get($strAttribute) Return $strResult EndFunc #endregion #endregion
×
×
  • Create New...