gcue Posted March 31 Share Posted March 31 (edited) Not sure what is happening. If i pass through an proxyAddresses search completes quickly (0 seconds). however if i pass an employeeid - the search takes muuuch longer (35 seconds). I tried searching by another field (which is also digits) - ipPhone (0 seconds) i specified the OU to see if it helped (in both queries) but it didnt. I am searching with an actual employeeId value (might be beside the point) Thoughts? $user = "39393" $user = "user@company.com" $sam_acct = Get_SamAccountNameY($user) Func Get_SamAccountNameY($iString) If StringInStr($iString, "@") <> 0 Then consolewrite("email identified" @crlf) $aObjects = _AD_GetObjectsInOU("OU=People,DC=user,DC=company,DC=com", "(proxyAddresses=smtp:" & $iString & ")", 2, "sAMAccountName") EndIf If StringIsDigit($iString) Then consolewrite("employeeid identified" @crlf) $aObjects = _AD_GetObjectsInOU("OU=People,DC=user,DC=company,DC=com", "(employeeID=" & $iString & ")", 2, "sAMAccountName") EndIf If $aObjects = @error Then Return SetError(1) EndIf $sam_account = $aObjects[1] Return $sam_account EndFunc ;==>Get_SamAccountNameY Edited April 1 by gcue Additional testing + results Link to comment Share on other sites More sharing options...
donnyh13 Posted April 1 Share Posted April 1 (edited) Not able to test right now, but I wonder if using Regexp would quicken things a bit for the employee ID? If i understand correctly, converting strings to numbers or testing strings if they are numbers does cause a slight delay? For the ID you could do... If Not StringRegExp($iString, "[^0-9]") Then (If $iString doesn't contain anything other than digits, Then.) Edit: I think i may have misunderstood where you think the problem is. Sorry. Please disregard. Edited April 1 by donnyh13 LibreOffice UDF ; Scite4AutoIt Spell-Checker Using LibreOffice Spoiler "Life is chiefly made up, not of great sacrifices and wonderful achievements, but of little things. It is oftenest through the little things which seem so unworthy of notice that great good or evil is brought into our lives. It is through our failure to endure the tests that come to us in little things, that the habits are molded, the character misshaped; and when the greater tests come, they find us unready. Only by acting upon principle in the tests of daily life can we acquire power to stand firm and faithful in the most dangerous and most difficult positions." Link to comment Share on other sites More sharing options...
Solution water Posted April 1 Solution Share Posted April 1 As you can see here property "proxyaddresses" is an indexed property and "employeeID" is not. Hence the difference in processing time. If needed you can add property "employeeID" to the list of indexed properties. 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...
gcue Posted April 1 Author Share Posted April 1 (edited) makes sense. found _AD_GetSchemaAttributes(3) - thanks for providing this dont see a function on the udf that provides the ability to index properties locally. i take it my only option to ask our domain team to index? Edited April 1 by gcue Link to comment Share on other sites More sharing options...
water Posted April 1 Share Posted April 1 Or you create a script that runs daily/weekly/... at nighttime to extract imployeeID and SamAccountName of all users and store this information in a text file or database for faster access. 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...
gcue Posted April 1 Author Share Posted April 1 Sounds good thanks water! Hope you have a great rest of the week Link to comment Share on other sites More sharing options...
water Posted April 1 Share Posted April 1 Hi gcue, I will. My vacation starts on Friday 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...
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