water Posted July 26, 2013 Author Share Posted July 26, 2013 What's the value of @error and @extended after _AD_GetObjectsInOU? 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 Link to comment Share on other sites More sharing options...
TheBG Posted July 26, 2013 Share Posted July 26, 2013 question: is there a way to use _AD_RecursiveGetMemberOf, _AD_IsMemberOf, or _AD_GetUserGroups to search only groups that start with a specific string? ex. I need to search AD by @username and return only AD groups that start with "Na-0000-Mon" . I need to know if the user is a member of any group that starts with Na-0000-Mon Link to comment Share on other sites More sharing options...
water Posted July 26, 2013 Author Share Posted July 26, 2013 Try : $sCN = _AD_SamAccountNameToFQDN(@Username) $aResult = _AD_GetObjectsInOU("", "(&(objectClass=group)(name=Na-0000-Mon*)(member=" & $sCN & "))", 2, "samaccount") Returns the samaccountnames of the groups starting with "Na-0000-Mon" where the current user is a member of. 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 Link to comment Share on other sites More sharing options...
TheBG Posted July 26, 2013 Share Posted July 26, 2013 I'm getting a COM error in the console #include <AD.au3> #include <Array.au3> _AD_Open() $sCN = _AD_SamAccountNameToFQDN(@Username) Global $aResult = _AD_GetObjectsInOU("", "(&(objectClass=group)(name=*-0000-Mon*)(member=" & $sCN & "))", 2, "samaccount") _ArrayDisplay($aResult) _AD_Close() COM Error Encountered in example2.au3 AD UDF version = 1.3.0 @AutoItVersion = 3.3.8.1 @AutoItX64 = 0 @Compiled = 0 @OSArch = X64 @OSVersion = WIN_7 Scriptline = 1219 NumberHex = 80020009 Number = -2147352567 WinDescription = Unspecified error Description = Unspecified error Source = Provider HelpFile = HelpContext = 1240640 LastDllError = 0 ======================================================== +>09:19:55 AutoIT3.exe ended.rc:0 >Exit code: 0 Time: 2.219 Link to comment Share on other sites More sharing options...
water Posted July 26, 2013 Author Share Posted July 26, 2013 My bad. Should be Global $aResult = _AD_GetObjectsInOU("", "(&(objectClass=group)(name=*-0000-Mon*)(member=" & $sCN & "))", 2, "samaccountname") 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 Link to comment Share on other sites More sharing options...
TheBG Posted July 26, 2013 Share Posted July 26, 2013 awesome! that works great!! thanks for your help Link to comment Share on other sites More sharing options...
water Posted July 26, 2013 Author Share Posted July 26, 2013 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 Link to comment Share on other sites More sharing options...
TheBG Posted July 26, 2013 Share Posted July 26, 2013 My bad. Should be Global $aResult = _AD_GetObjectsInOU("", "(&(objectClass=group)(name=*-0000-Mon*)(member=" & $sCN & "))", 2, "samaccountname") Is there a way to make this serach across multiple domains? we have 4 domains to search across Link to comment Share on other sites More sharing options...
TheBG Posted July 27, 2013 Share Posted July 27, 2013 Is there a way to make this serach across multiple domains? we have 4 domains to search across nevermind, I figured it out!! :-) by using the _AD_Open() parameters Link to comment Share on other sites More sharing options...
water Posted July 27, 2013 Author Share Posted July 27, 2013 Did you have a look at the wiki? There you find some additional information about the AD UDF. 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 Link to comment Share on other sites More sharing options...
TheBG Posted July 30, 2013 Share Posted July 30, 2013 Did you have a look at the wiki? There you find some additional information about the AD UDF. actually, I just looked at AD.au3 and got all the info I needed. so now, Im trying to figure out something. now, I need to get all security groups with *-0000-MonD-* and list the users/members I seem to be at a loss on this one. Link to comment Share on other sites More sharing options...
water Posted July 30, 2013 Author Share Posted July 30, 2013 Try: Global $aResult = _AD_GetObjectsInOU("", "(&(objectClass=group)(name=*-0000-MonD-*))", 2, "samaccountname,member") Returns a 2D array with the samaccountname of the group in the first element and a list of FQDN member names separated by the pipe character (|) in the second element. 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 Link to comment Share on other sites More sharing options...
TheBG Posted July 30, 2013 Share Posted July 30, 2013 Try: Global $aResult = _AD_GetObjectsInOU("", "(&(objectClass=group)(name=*-0000-MonD-*))", 2, "samaccountname,member") Returns a 2D array with the samaccountname of the group in the first element and a list of FQDN member names separated by the pipe character (|) in the second element. ok, this rocks... I have it going across all domains and pulling the AD groups with the search string. it's not listing all the members though.. Also is there a way to display like the user ID and not the full FQDN? Link to comment Share on other sites More sharing options...
water Posted July 30, 2013 Author Share Posted July 30, 2013 It's not listing all the members though.How many members are missing? How many members do you have in a group? Also is there a way to display like the user ID and not the full FQDN?You would need to call _AD_FQDNToSamAccountName for each 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 Link to comment Share on other sites More sharing options...
TheBG Posted July 30, 2013 Share Posted July 30, 2013 How many members are missing? How many members do you have in a group? You would need to call _AD_FQDNToSamAccountName for each member. How many members are missing? How many members do you have in a group? in some cases, all members are missing. and the main group we use only lists 1 user, and I know we have at least 500 members. Link to comment Share on other sites More sharing options...
water Posted July 30, 2013 Author Share Posted July 30, 2013 The primary group (you call it "main group") doesn't contain any members - would be too many. The primary group has a group id that is stored with every user. To get the members of a primary group is a bit more complex. 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 Link to comment Share on other sites More sharing options...
kor Posted August 2, 2013 Share Posted August 2, 2013 having a problem with our scripts on a new active directory running on server 2012. The forest and domain functional levels are 2012. The scripts are being run from a Win 7 x86 client joined to the domain. Trying to run a sample script _AD_ObjectExists() on a user and get an _AD_Open() failure. Function _AD_Open encountered a problem. @error = 4, @extended = -2147024843 I'm pretty sure that it's a permissions problem somehow, but @error4 in the _AD_Open example says something about a RootDSE object failure. So not sure what is going on. When I run the same scripts as user within the IT department (who has elevated permissions in AD) all the scripts work fine and there are no issues. Link to comment Share on other sites More sharing options...
water Posted August 2, 2013 Author Share Posted August 2, 2013 -2147024843 means: 0x80070035 The network path was not found I once had the same problem because the directory where the exe was located wasn't a trusted location. Copy the exe to a local drive and try again. 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 Link to comment Share on other sites More sharing options...
kor Posted August 3, 2013 Share Posted August 3, 2013 -2147024843 means: 0x80070035 The network path was not found I once had the same problem because the directory where the exe was located wasn't a trusted location. Copy the exe to a local drive and try again. that was the problem. Thank you for helping me narrow the problem. Now I just need to figure out what permissions to give the directory so I don't get the error. Link to comment Share on other sites More sharing options...
water Posted August 3, 2013 Author Share Posted August 3, 2013 Another user and I once spent a lot of time to find the problem. I'm glad your script works now 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 Link to comment Share on other sites More sharing options...
Recommended Posts