lafafmentvotre Posted June 17, 2009 Share Posted June 17, 2009 (edited) Hi everybodyFirst, sorry for my bad english.Second, i need to list members of a group in Active Directory.I read this topic and i use this script :expandcollapse popup#include <array.au3> ; For _ArrayDisplay() #include <adfunctions.au3> Dim $sGroup_Name = "my group" Dim $avList_Of_Members _ADGetGroupMemberOf ($avList_Of_Members, $sGroup_Name) _ArrayDisplay($avList_Of_Members, "Members of group: " & $sGroup_Name)oÝ÷ Ø'(Ê%z·º¹Þ®º+jëh×6>"C:\Program Files\AutoIt3\SciTE\..\autoit3.exe" /ErrorStdOut "D:\Backup_DD_Externe\AutoIt Development\Send_Mailing\test.au3" C:\Program Files\AutoIt3\Include\adfunctions.au3 (472) : ==> Object referenced outside a "With" statement.: $membersadd = $objRecordSet.fields (0).Value $membersadd = $objRecordSet.fields (0)^ ERROR >Exit code: 1 Time: 0.739oÝ÷ Ù©ÝêÞËayÆ¥ç_ºw-ÚºÚ"µÍÈÐQÙ]ÜÝY[XÙ[ÈÐQÙ]ÜÝY[XÙTY ÌÍÛY[XÙ ÌÍÙÜÝ ÌÍÜÛÜH BSØØ[ ÌÍÛÕÜ ÌÍÛØÛÛ[X[ ÌÍÙÜÝË ÌÍÛY[XØYIÌÍÛØÛÛ[X[HØÜX]J ][ÝÐQÑÛÛ[X[ ][ÝÊBIÌÍÛØÛÛ[X[XÝ]PÛÛXÝ[ÛH ÌÍÛØÛÛXÝ[ÛIÌÍÛØÛÛ[X[ÜYÈ ][ÝÔÙXÚØÛÜI][ÝÊHHBQ[H ÌÍÛY[XÙÌWBIÌÍÚHHUÚ[HBBIÌÍÜ[Ù[[ÙYYH ÌÍÚH LBIÌÍÜ[ÙHH ][ÝÔ[ÙOI][ÝÈ [È ÌÍÜ[Ù[[ÙYY [È ][ÝËI][ÝÈ [È ÌÍÜ[Ù[[ÙYY ÈNNBBIÌÍÜÝÛY^H ][ÝÉÓTËÉ][ÝÈ [È ÌÍÜÝÜÝÙ [È ][ÝËÉ][ÝÈ [È ÌÍÙÜÝ [È ][ÝÉÝÎÎÛY[XÙÉ][ÝÈ [È ÌÍÜ[ÙH [È ][ÝÎØÙI][ÝÂBIÌÍÛØÛÛ[X[ÛÛ[X[^H ÌÍÜÝÛY^BIÌÍÛØXÛÜÙ]H ÌÍÛØÛÛ[X[^XÝ]BBIÌÍÛY[XØYH ÌÍÛØXÛÜÙ]Y[È K[YBBRY ÌÍÛY[XØYH[^]ÛÜBTQ[H ÌÍÛY[XÙÕPÝ[ ÌÍÛY[XÙH ÈLBBQÜ ÌÍÚH ÌÍÜ[Ù[[ÙYY ÈHÈ ÌÍÜ[Ù[[ÙYY ÈLBBIÌÍÛY[XÙÉÌÍÚHH ÌÍÛY[XØYÉÌÍÚH ÌÍÜ[Ù[[ÙYYHWBBS^BIÌÍÚH ÏHBBIÌÍÛØXÛÜÙ]ÛÜÙBUÑ[IÌÍÜ[Ù[[ÙYYH ÌÍÚH LIÌÍÜ[ÙHH ][ÝÔ[ÙOI][ÝÈ [È ÌÍÜ[Ù[[ÙYY [È ][ÝËJ][ÝÂIÌÍÜÝÛY^H ][ÝÉÓTËÉ][ÝÈ [È ÌÍÜÝÜÝÙ [È ][ÝËÉ][ÝÈ [È ÌÍÙÜÝ [È ][ÝÉÝÎÎÛY[XÙÉ][ÝÈ [È ÌÍÜ[ÙH [È ][ÝÎØÙI][ÝÂIÌÍÛØÛÛ[X[ÛÛ[X[^H ÌÍÜÝÛY^IÌÍÛØXÛÜÙ]H ÌÍÛØÛÛ[X[^XÝ]BIÌÍÛY[XØYH ÌÍÛØXÛÜÙ]Y[È K[YNÏOIÝÈSH ÂTQ[H ÌÍÛY[XÙÕPÝ[ ÌÍÛY[XÙH ÈPÝ[ ÌÍÛY[XØY HBQÜ ÌÍÚH ÌÍÜ[Ù[[ÙYY ÈHÈ ÌÍÜ[Ù[[ÙYY ÈPÝ[ ÌÍÛY[XØY BBIÌÍÛY[XÙÉÌÍÚHH ÌÍÛY[XØYÉÌÍÚH ÌÍÜ[Ù[[ÙYYHWBS^IÌÍÛØXÛÜÙ]ÛÜÙBBIÌÍÛØÛÛ[X[HIÌÍÛØXÛÜÙ]HBIÌÍÛY[XÙÌHHPÝ[ ÌÍÛY[XÙHHBBRY ÌÍÜÛÜHH[BWÐ^TÛÜ ÌÍÛY[XÙJBQ[YBT] ÌÍÛY[XÙÌBB[[ÈÏOIÝ×ÐQÙ]ÜÝY[XÙSomeone can help me please ?Thank you Edited June 17, 2009 by lafafmentvotre Link to comment Share on other sites More sharing options...
water Posted June 17, 2009 Share Posted June 17, 2009 Your code looks a bit scrambled at the end#include <array.au3> ; For _ArrayDisplay()#include <adfunctions.au3>Dim $sGroup_Name = "my group"Dim $avList_Of_Members_ADGetGroupMemberOf ($avList_Of_Members, $sGroup_Name)_ArrayDisplay($avList_Of_Members, "Members of group: " & $sGroup_Name)oÝ÷ Ù»y²rì¢WêÞƧzºè«¢+ØÐìÅÕ½ÐíBut from what I can see you use adfunctions.au3 which should make it very easy to do what you want.Can you describe more in detail what your problem is? Doesn't your script return any records? Do you get a COM error? ... My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
lafafmentvotre Posted June 17, 2009 Author Share Posted June 17, 2009 (edited) Your code looks a bit scrambled at the endSorry, the topic is ok now.Someone can help me please ? Edited June 17, 2009 by lafafmentvotre Link to comment Share on other sites More sharing options...
water Posted June 17, 2009 Share Posted June 17, 2009 (edited) Do you use the full qualified name of the group (e.g. CN=groupname,OU=Example_Group,DC=microsoft,DC=com)? If not you can translate the "short name" (samAcocuntName) to a FQDN. $sGroup_Name = _ADSamAccountNameToFQDN("my group") Edited June 17, 2009 by water My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
lafafmentvotre Posted June 17, 2009 Author Share Posted June 17, 2009 Hello Must i have to modify this lines in adfunctions.au3 with my AD config ? Global $objRootDSE = ObjGet("LDAP://RootDSE") Global $strDNSDomain = $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 Link to comment Share on other sites More sharing options...
water Posted June 17, 2009 Share Posted June 17, 2009 Must i have to modify this lines in adfunctions.au3 with my AD config ?No, your script can be as short as: #include <array.au3> #include <adfunctions.au3> Dim $avList_Of_Members Dim $sGroup_Name = _ADSamAccountNameToFQDN("my group") _ADGetGroupMemberOf ($avList_Of_Members, $sGroup_Name) _ArrayDisplay($avList_Of_Members, "Members of group: " & $sGroup_Name) My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
lafafmentvotre Posted June 17, 2009 Author Share Posted June 17, 2009 It doesn't work and this the same error msg : >"C:\Program Files\AutoIt3\SciTE\..\autoit3.exe" /ErrorStdOut "D:\Backup_DD_Externe\AutoIt Development\Send_Mailing\test.au3" C:\Program Files\AutoIt3\Include\adfunctions.au3 (472) : ==> Object referenced outside a "With" statement.: $membersadd = $objRecordSet.fields (0).Value $membersadd = $objRecordSet.fields (0)^ ERROR >Exit code: 1 Time: 0.428 Link to comment Share on other sites More sharing options...
water Posted June 17, 2009 Share Posted June 17, 2009 Sorry, my fault. i need to list members of a group in Active Directory. You have to use function _ADGetGroupMembers not _ADGetGroupMemberOf. So your script should now look like: #include <array.au3> #include <adfunctions.au3> Dim $avList_Of_Members Dim $sGroup_Name = _ADSamAccountNameToFQDN("my group") _ADGetGroupMembers ($avList_Of_Members, $sGroup_Name) _ArrayDisplay($avList_Of_Members, "Members of group: " & $sGroup_Name) My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
lafafmentvotre Posted June 18, 2009 Author Share Posted June 18, 2009 You have to use function _ADGetGroupMembers not _ADGetGroupMemberOf. So your script should now look like: Hi Same error : >"C:\Program Files\AutoIt3\SciTE\..\autoit3.exe" /ErrorStdOut "D:\Backup_DD_Externe\AutoIt Development\Send_Mailing\test.au3" C:\Program Files\AutoIt3\Include\adfunctions.au3 (418) : ==> Object referenced outside a "With" statement.: $membersadd = $objRecordSet.fields (0).Value $membersadd = $objRecordSet.fields (0)^ ERROR >Exit code: 1 Time: 0.527 The error is in adfunctions.au3 not in my test script. thanks for help Link to comment Share on other sites More sharing options...
water Posted June 18, 2009 Share Posted June 18, 2009 Could you please run the following script to test the existance of your group? Set $sGroup_Name to SamAccountName (the one without CN= ...) of your group.#include <array.au3> ; For _ArrayDisplay() #include <adfunctions.au3> Dim $sGroup_Name = 'Your groupname' Dim $avList_Of_Members If _ADObjectExists($sGroup_Name) = 1 Then MsgBox(0,"","Group " & $sGroup_Name & " exists!") Else MsgBox(0,"","Group " & $sGroup_Name & " does not exist!") Exit EndIf $sGroup_Name = _ADSamAccountNameToFQDN($sGroup_Name) _ADGetGroupMembers ($avList_Of_Members, $sGroup_Name) _ArrayDisplay($avList_Of_Members, "Members of group: " & $sGroup_Name) My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
lafafmentvotre Posted June 19, 2009 Author Share Posted June 19, 2009 Hi water My group exist, your script is ok. I have just realized that i confuse GROUP and OU. My request for the topic is to list members for an ACTIVE DIRECTORY OU. Is it possible with adfunctions.au3 ? Really i'm sorry for this error Thanks Link to comment Share on other sites More sharing options...
water Posted June 19, 2009 Share Posted June 19, 2009 You could use something like#include <array.au3> #include <adfunctions.au3> Dim $avList_Of_Members Dim $sOU = "OU=xy,OU=123,OU=User_Accounts,DC=microsoft,DC=com" _ADGetObjectsInOU($avList_Of_Members, $sOU) _ArrayDisplay($avList_Of_Members, "Members of OU: " & $sOU) My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
lafafmentvotre Posted June 19, 2009 Author Share Posted June 19, 2009 (edited) CODE: AutoIt #include <array.au3> #include <adfunctions.au3> Dim $avList_Of_Members Dim $sOU = "OU=xy,OU=123,OU=User_Accounts,DC=microsoft,DC=com" _ADGetObjectsInOU($avList_Of_Members, $sOU) _ArrayDisplay($avList_Of_Members, "Members of OU: " & $sOU) I change $sOU value with my config and I test it but it doesn't work. This is the error msg : We intercepted a COM Error ! Number is: 000000A9 Windescription is: Variable must be of type 'Object'. Script Line number is: 641 I think le line 641 is in adfunctions.au3 and this is the line : $recordcount = $objRecordSet.RecordCount Help me please Thanks Edited June 19, 2009 by lafafmentvotre Link to comment Share on other sites More sharing options...
water Posted June 19, 2009 Share Posted June 19, 2009 You get this error message when the OU-string is not correct. Could you please post the complete OU string you use (if you want you can change some letters but please don't change the OU=..,DC=... format). My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
lafafmentvotre Posted June 19, 2009 Author Share Posted June 19, 2009 Hello Here it is : OU=S1761,OU=LMC,OU=Users,OU=AD,DC=fr,DC=rcc I have this line from AD Schema Link to comment Share on other sites More sharing options...
water Posted June 20, 2009 Share Posted June 20, 2009 (edited) Your OU-string looks fine.Another question: which version of adfunctions do you use? The latest version I've found can be donwloaded from here. In an old version there seemed to be a problem with _ADGetObjectsInOU.Could you please download the latest version and give it a try? Edited June 20, 2009 by water My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
lafafmentvotre Posted June 20, 2009 Author Share Posted June 20, 2009 (edited) HelloThanks for responses.I take adfunctions.au3 ont this topicand your link doesn't work Edited June 20, 2009 by lafafmentvotre Link to comment Share on other sites More sharing options...
water Posted June 20, 2009 Share Posted June 20, 2009 Hi, the adfunctions udf you downloaded is quite old and might have the bug I was talking about. I've corrected the link in my previous post. Could you please download this version and try again? My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
lafafmentvotre Posted June 20, 2009 Author Share Posted June 20, 2009 Hi Water Thank you. I try this monday morning. Have a good week end Link to comment Share on other sites More sharing options...
lafafmentvotre Posted June 23, 2009 Author Share Posted June 23, 2009 Hi Water It's ok for me. The new adfunctions.au3 run. Thank you for your help Have a nice day Link to comment Share on other sites More sharing options...
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