water Posted December 17, 2010 Author Share Posted December 17, 2010 (edited) I downloaded Sysinternals (now M$) ADInsight and checked what's going on during LDAP execution.Just download and run the exe. The AutoIt script becomes very, very slow but on the other hand you get a very good insight.I inserted the modified RootDSE access and the number of binds dropped significantly.Can we create a test script (one that uses read-only functions as I only have read access to our AD) and check it with different operating systems?Edit:I checked an application already in production and the number of binds dropped from many hundreds or thousands (had to kill it because it took hours to monitor) to only 2 (one bind to the domain and one to domain + server).I think our problem can be solved with the modified RootDSE access. Edited December 17, 2010 by water 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...
SpinningCone Posted December 17, 2010 Share Posted December 17, 2010 I downloaded Sysinternals (now M$) ADInsight and checked what's going on during LDAP execution.Just download and run the exe. The AutoIt script becomes very, very slow but on the other hand you get a very good insight.I inserted the modified RootDSE access and the number of binds dropped significantly.Can we create a test script (one that uses read-only functions as I only have read access to our AD) and check it with different operating systems?Edit:I checked an application already in production and the number of binds dropped from many hundreds or thousands (had to kill it because it took hours to monitor) to only 2 (one bind to the domain and one to domain + server).I think our problem can be solved with the modified RootDSE access.nice. yeah looks like your production environment could handle enough connections to keep up. ours was punking out. i'm guessing the original root dse is good enough to pull data out (after all it can query the server for the proper information) but not good enough to properly re-use as a base ldap connection. would be nice to get a few more testers out there to make sure that this won;t cause otehr problems but it looks like a solid update tot he UDF. nice work. Link to comment Share on other sites More sharing options...
water Posted December 17, 2010 Author Share Posted December 17, 2010 (edited) I did some more testing:_AD_Open() - no additional binds_AD_Open("", "", $sAD_DNSDomainParam, $sAD_HostServerParam, $sAD_ConfigurationParam) - no additional binds_AD_Open("userid", "password") - gives large number of binds_AD_Open("userid", "password", $sAD_DNSDomainParam, $sAD_HostServerParam, $sAD_ConfigurationParam) - gives large number of binds[sOLVED] If I understand the link you provided correctly the bind cache should be used even when OpenDSObject is used. Do you know what might cause this problem? Edited December 19, 2010 by water 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...
water Posted December 19, 2010 Author Share Posted December 19, 2010 Version 0.42 has been released.This version does some major bug fixing in _AD_Open!Thanks a lot to SpinningCone for taking the time to help me solve this problem!Now your AD scripts should run noticeably faster (depending on the number of AD requests) and it should no longer be necessary to insert SLEEP statements into your script to avoid some strange COM errors.Please test before using it in production!For download please see 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 Link to comment Share on other sites More sharing options...
HaeMHuK Posted December 22, 2010 Share Posted December 22, 2010 Thanks a lot for AD UDF. I have configured it according to my purposes. But there is one thing should work for me too. All created users has empty fields (First name and Last name). Is there any ways to fill this fields with this UDF? Thanks in advanced. Link to comment Share on other sites More sharing options...
water Posted December 22, 2010 Author Share Posted December 22, 2010 _AD_CreateUser only sets the properties necessary to create the user. To set further properties please use _AD_ModifyAttribute. 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...
HaeMHuK Posted December 23, 2010 Share Posted December 23, 2010 _AD_CreateUser only sets the properties necessary to create the user.To set further properties please use _AD_ModifyAttribute.Thanks a lot. Everything perfect now. Link to comment Share on other sites More sharing options...
water Posted December 23, 2010 Author Share Posted December 23, 2010 Glad to hear! Merry Christmas and a happy new year to all AutoIT users! I'm on vacation now and will be back the 3rd January. 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 January 17, 2011 Share Posted January 17, 2011 I'm trying to get the username of the first row of GetAccountsExpired. But it is a multidimensional array and I can't seem to extra the value into a string. Is there some way I can read the expired accounts from the first row and first column of the array so I can do a stringtrim to get just the CN=<username> ?? Link to comment Share on other sites More sharing options...
water Posted January 19, 2011 Author Share Posted January 19, 2011 To access the first element of each row I would use: #include <ad.au3> _AD_Open() $aExpired = _AD_GetAccountsExpired() For $i = 1 to $aExpired[0][0] $aTemp = StringSplit($aExpired[$i][0],",") ConsoleWrite(StringMid($aTemp[1],4) & @CRLF) 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 Link to comment Share on other sites More sharing options...
secman Posted January 21, 2011 Share Posted January 21, 2011 First of all, thanks for all your work and John's of course, on this brilliant set of UDFs. Although I am not a programmer by trade, I have been able to put together a couple of utilities for use here at the school where I work to help us in day to day tasks. I am currently putting together a script to create our yearly batch of new students from a csv file. I have also developed a script to create a single user which works fine but when I use the same functions and AD UDFs to create a number of users I get an error when the program starts to process the second user in the csv file. The bit of code that is failing is as follows:- Func CreateUser($sOU, $sUser, $sFullName) ; Create User MsgBox(0,"Create User", $sOU & $sUser & $sFullName) Global $iValue = _AD_CreateUser($sOU, $sUser, $sFullName) If $iValue = 1 Then MemoWrite ("User " & $sUser & " created") ElseIf @error = 1 Then $val = "XX" MsgBox(64, "Create New User", "User '" & $sUser & "' already exists") ElseIf @error = 2 Then $val = "XX" MsgBox(64, "Create New User", "OU '" & $sOU & "' does not exist") ElseIf @error = 3 Then $val = "XX" MsgBox(64, "Create New User", "Value for CN (e.g. Lastname Firstname) is missing") ElseIf @error = 4 Then $val = "XX" MsgBox(64, "Create New User", "Value for $sAD_User is missing") Else $val = "XX" MsgBox(64, "Create New User", "Return code '" & @error & "' from Active Directory") EndIf EndFunc (Some of the code is part of my testing/error handling/checking and will be removed once everything is working.) I get the following error (running from within the SciTE4Autoit3 Editor) :- >"C:\Program Files\AutoIt3\SciTE\..\autoit3.exe" /ErrorStdOut "H:\Scripts\User Admin\Create Multipl User.au3" C:\Program Files\AutoIt3\Include\AD.au3 (569) : ==> Variable must be of type "Object".: Local $oAD_RecordSet = $oAD_Connection.Execute($sAD_Query) Local $oAD_RecordSet = $oAD_Connection^ ERROR >Exit code: 1 Time: 34.667 As the error reported is from within the AD.au3 UDF I thought I had better seek (much) more knowledgeable help. Alan Link to comment Share on other sites More sharing options...
water Posted January 21, 2011 Author Share Posted January 21, 2011 (edited) C:\Program Files\AutoIt3\Include\AD.au3 (569) : ==> Variable must be of type "Object".: Local $oAD_RecordSet = $oAD_Connection.Execute($sAD_Query) Local $oAD_RecordSet = $oAD_Connection^ ERROR >Exit code: 1 Time: 34.667 It looks like the object $oAD_Connection is not available. This object is defined in function _AD_Open. So my question is: Did you call _AD_Open() at the top of your script? For details please see the ReadMe.txt file in the AD.ZIP: How to use the Active Directory UDF 2010-06-14 -------------------------------------------------------------------------- * Every script has to have the following format: _AD_Open() ; open a onnection to the AD calls to other _AD-functions ; query or manipulate the AD _AD_Close() Edited January 21, 2011 by water 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...
secman Posted January 21, 2011 Share Posted January 21, 2011 C:\Program Files\AutoIt3\Include\AD.au3 (569) : ==> Variable must be of type "Object".: Local $oAD_RecordSet = $oAD_Connection.Execute($sAD_Query) Local $oAD_RecordSet = $oAD_Connection^ ERROR >Exit code: 1 Time: 34.667 It looks like the object $oAD_Connection is not available. This object is defined in function _AD_Open. So my question is: Did you call _AD_Open() at th top of your script? For details please see the ReadMe.txt file in the AD.ZIP: How to use the Active Directory UDF 2010-06-14 -------------------------------------------------------------------------- * Every script has to have the following format: _AD_Open() ; open a onnection to the AD calls to other _AD-functions ; query or manipulate the AD _AD_Close() Oops! That's what was missing... There is a "AD Open" statement at the top of the whole script for something else and that must have allwoed the first ID to be created. All OK Now. Many thanks again for you excellent work and such a quick response. Alan Link to comment Share on other sites More sharing options...
water Posted January 21, 2011 Author Share Posted January 21, 2011 Glad to be of service 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...
water Posted March 1, 2011 Author Share Posted March 1, 2011 (edited) Hi Water: I know you've heard it many times, but your Active Directory Function Library is fantastic. Quick question, do you have a sample script that would include all the functions/steps necessary to join a machine to the domain (that has never been joined before)? I've looked and looked, but can't seem to find anything. I'm very new at this and just want to ensure I don't miss anything. Thanks!!!Hi peomalle, can't hear it too often To join a computer to a domain two steps are necessary: _AD_CreateComputer($sAD_OU, $sAD_Computer, $sAD_User) to create a computer account in the specified OU. $sAD_User is the user or group that will be allowed to add the computer to the domain (SamAccountName)_AD_JoinDomain($sAD_Computer[, $sAD_UserParam, $sAD_PasswordParam]) to join the computer to the domain. UserParam and PasswordParam are optional and need to be used when the user who is running the script doesn't have the needed rights to join the computer to the domainReboot the computerBTW: This reminds me of the Monthy Python Sketch "The Spanish Inquisition". Always listing one more weapon as they announced to have. Edited March 1, 2011 by water 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...
water Posted March 1, 2011 Author Share Posted March 1, 2011 (edited) Version 0.43 has been released.Please test before using in production!For download please see my signature. Edited March 1, 2011 by water 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...
BrewManNH Posted March 22, 2011 Share Posted March 22, 2011 Not really a bug, but I noticed in the latest download the version number is showing 0.41. Great UDF by the way, love having it available. If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag GudeHow to ask questions the smart way! I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from. Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays. - ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script. - Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label. - _FileGetProperty - Retrieve the properties of a file - SciTE Toolbar - A toolbar demo for use with the SciTE editor - GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI. - Latin Square password generator Link to comment Share on other sites More sharing options...
water Posted March 22, 2011 Author Share Posted March 22, 2011 Hi BrewManNH,just did a download from the download page and AD.au3 shows version 0.43 in the header.Where did you find version number 0.41? 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...
BrewManNH Posted March 22, 2011 Share Posted March 22, 2011 Sorry about that, I must have had the wrong files in one of my include folders, I just reopened the download and checked the version numbers in that and it's fine. If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag GudeHow to ask questions the smart way! I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from. Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays. - ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script. - Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label. - _FileGetProperty - Retrieve the properties of a file - SciTE Toolbar - A toolbar demo for use with the SciTE editor - GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI. - Latin Square password generator Link to comment Share on other sites More sharing options...
water Posted March 22, 2011 Author Share Posted March 22, 2011 I like this kind of problems - so easy to solve 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