Jump to content

searching for employeeId takes longer than searching for proxyaddress


Go to solution Solved by water,

Recommended Posts

Posted (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 by gcue
Additional testing + results
Posted (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

Edit: I think i may have misunderstood where you think the problem is. Sorry. Please disregard.

Edited 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."

 

  • Solution
Posted

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 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

 

Posted (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 by gcue
Posted

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 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

 

Posted

Hi gcue,

I will. My vacation starts on Friday :)

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

 

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...