water Posted July 20, 2015 Author Posted July 20, 2015 I'm on vacation right now. Will play with it nect week. My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki
araneon Posted August 5, 2015 Posted August 5, 2015 Tell me how to get a list of certain groups (RND_DB_1C_HHH where any signs XXX) in which the user is involved?That is, display a list of groups that starts at just RND_DB_1C_?
water Posted August 5, 2015 Author Posted August 5, 2015 Function _AD_GetObjectsInOU should do the trick.Or _AD_GetUserGroups (plus ignore all groups you do not need).Do you want to process the groups recursively? Means user is member of group A which has group RND_DB_1C_* as a member? My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki
legend Posted August 7, 2015 Posted August 7, 2015 How would I get some information from a OU?I need to get the information : State/Province from the OU that a specefic user is in.Here i'm getting the OU : "it" from the user "miin", now I need to get the state/province from the ou: "it": Here's the example i use to get the ou from a specefic user:; Open Connection to the Active Directory _AD_Open() If @error Then Exit MsgBox(16, "Active Directory Example Skript", "Function _AD_Open encountered a problem. @error = " & @error & ", @extended = " & @extended) ; ******************************************************************************** ; Example 1 - Process the current user. ; Get the FQDN from the SamAccountname. Then get the SamAccountName from the FQDN. ; ******************************************************************************** ; Get the Fully Qualified Domain Name (FQDN) for the current User Global $sFQDN = _AD_SamAccountNameToFQDN("miin") ; Get the sAMAccountName from the Fully Qualified Domain Name (FQDN) for the current User Global $sSamAccountName = _AD_FQDNToSamAccountName($sFQDN) MsgBox(64, "Active Directory Functions - Example 1", $sFQDN)
water Posted August 7, 2015 Author Posted August 7, 2015 Will post an example as soon as I return to my office. My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki
water Posted August 7, 2015 Author Posted August 7, 2015 This new function (will be available with the next release of the UDF) should do the trick:expandcollapse popup#include <AD.au3> _AD_Open() $sOU = _AD_GetObjectOU(@UserName) $sState = $_AD_GetObjectAttribute(@sOU, "xxx") ; Replace xxx with the attribute that holds the state ConsoleWrite("State is: " & $sState) _AD_Close() ; #FUNCTION# ==================================================================================================================== ; Name...........: _AD_GetObjectOU ; Description ...: Returns the OU (Organizational Unit) of an object ("user", "group" etc.). ; Syntax.........: _AD_GetObjectOU($sObject) ; Parameters ....: $sObject - Object for which the main class should be returned. Can be specified as Fully Qualified Domain Name (FQDN) or sAMAccountName ; Return values .: Success - FQDN of the object's OU. ; Failure - "", sets @error to: ; |1 - Specified object does not exist ; |2 - The LDAP query returned no record. @extended is set to the error returned by LDAP ; Author ........: water ; Modified.......: ; Remarks .......: ; Related .......: ; Link ..........: ; Example .......: Yes ; =============================================================================================================================== Func _AD_GetObjectOU($sObject) If _AD_ObjectExists($sObject) = 0 Then Return SetError(1, 0, "") If StringLeft($sObject, 7) <> "LDAP://" Then ; No ADsPath Local $sProperty = "sAMAccountName" If StringMid($sObject, 3, 1) = "=" Then $sProperty = "distinguishedName" ; FQDN provided $__oAD_Command.CommandText = "<LDAP://" & $sAD_HostServer & "/" & $sAD_DNSDomain & ">;(" & $sProperty & "=" & $sObject & ");ADsPath;subtree" Local $oRecordSet = $__oAD_Command.Execute ; Retrieve the ADsPath for the object If @error Or Not IsObj($oRecordSet) Then Return SetError(2, @error, "") $sObject = $oRecordSet.fields(0).value EndIf Local $oObject = __AD_ObjGet($sObject) ; Retrieve the COM Object for the object Local $oOU = __AD_ObjGet($oObject.Parent) ; Get parent of the object (= OU) Return $oOU.Get("distinguishedName") ; Get distinguishedName (FQDN) for OU EndFunc ;==>_AD_GetObjectOU My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki
water Posted August 8, 2015 Author Posted August 8, 2015 Version 1.4.2.0 of the UDF has been released.Now runs with all versions of AutoIt >= 3.3.8.1.Please test before using in production!For download please see my signature. My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki
araneon Posted August 8, 2015 Posted August 8, 2015 Function _AD_GetObjectsInOU should do the trick.Or _AD_GetUserGroups (plus ignore all groups you do not need).Do you want to process the groups recursively? Means user is member of group A which has group RND_DB_1C_* as a member?I want to do what they do in this article only AutoIT.
water Posted August 8, 2015 Author Posted August 8, 2015 Unfortunately my Russian is a bit rusty What have you tried so far? Did my suggestion help? My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki
araneon Posted August 8, 2015 Posted August 8, 2015 More yet, now in the process.I have difficulty with my group parsing required. Do you want to process the groups recursively? Means user is member of group A which has group RND_DB_1C_* as a member?Yes, that's what I need.
araneon Posted August 8, 2015 Posted August 8, 2015 There are groups in blood pressure that are called RND_DB_1C_TIS RND_DB_1C_ZUP RND_DB_1C_IGR, overall they have both seen RND_DB_1C_, how to search these gurppy the current user?
water Posted August 8, 2015 Author Posted August 8, 2015 $aGroups = _AD_RecursiveGetMemberOf(@Username, 10, False, False)Should return a list of all groups the current user is a member of. Extract all groups starting with "RND_DB_1C". My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki
araneon Posted August 8, 2015 Posted August 8, 2015 $aGroups = _AD_RecursiveGetMemberOf(@Username, 10, False, False)YES, it displays a list of all user groups.
water Posted August 9, 2015 Author Posted August 9, 2015 You simply have to grab those groups you are interested in:$aGroups = _AD_RecursiveGetMemberOf(@Username, 10, False, False) For $i = 1 To $aGroups[0] If StringLeft($aGroups[$i], 9) = "RND_DB_1C" Then ; Process the group Next My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki
kcvinu Posted August 10, 2015 Posted August 10, 2015 I was wandering in the forums to know more stuff. Suddenly i saw this post. But i didn't knew anything about Active Directory. When i first that word, i thought that it was the active explorer window. Then i started googling. And found this MSDN link. I think this will be useful for the newcomers of this post. If possible please try to include this on help file.https://msdn.microsoft.com/en-us/library/aa746492(v=vs.85).aspx Spoiler My Contributions Glance GUI Library - A gui library based on Windows api functions. Written in Nim programming language. UDF Link Viewer --- A tool to visit the links of some most important UDFs Includer_2 ----- A tool to type the #include statement automatically Digits To Date ----- date from 3 integer values PrintList ----- prints arrays into console for testing. Alert ------ An alternative for MsgBox MousePosition ------- A simple tooltip display of mouse position GRM Helper -------- A littile tool to help writing code with GUIRegisterMsg function Access_UDF -------- An UDF for working with access database files. (.*accdb only)
legend Posted August 10, 2015 Posted August 10, 2015 (edited) I can't get it to return the groups: #include <AD\AD.au3> _AD_Open() $aGroups = _AD_RecursiveGetMemberOf(@Username, 10, False, False) MsgBox("","",$aGroups) _AD_Close() It shows a empty msgbox Your example from #1308,It can't find the macro @sOU: http://puu.sh/jvWIj/0882e6b7e4.png Edited August 10, 2015 by legend
water Posted August 10, 2015 Author Posted August 10, 2015 Sorry, thats a typo. Should be $sOU. My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki
water Posted August 10, 2015 Author Posted August 10, 2015 I was wandering in the forums to know more stuff. Suddenly i saw this post. But i didn't knew anything about Active Directory. When i first that word, i thought that it was the active explorer window. Then i started googling. And found this MSDN link. I think this will be useful for the newcomers of this post. If possible please try to include this on help file.https://msdn.microsoft.com/en-us/library/aa746492(v=vs.85).aspxI have added a link to MSDN in the wiki. kcvinu 1 My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki
Recommended Posts