Jump to content

ADFunctions.au3 Error


Recommended Posts

I'm using the ADFunctions.au3 function in one of my scripts to pull the Memberof information for about 3,500 computers. It does really well for a long time and then I get an error :

Line 362 (File "ADFunctions.au3"):
$memberof = $objItem.GetEx("memberof")
$memberof = ^ ERROR

Error: Error in expression.

What really confuses me is that this hits after 3,200+/- computers have already been processed. Do I just have one really screwed up computer out there or is there really an error?

How can I work around this error and get it to return an "oops" in my output file?? (not using msgbox, writing all results to CSV for data use).

The code around line 362 is :

Func _ADRecursiveGetMemberOf(ByRef $memberof, $fqdn)
    Local $objItem, $tempmemberof, $i = 0
    
    $objItem = _ADObjGet("LDAP://" & $strHostServer & "/" & $fqdn); Retrieve the COM Object for the logged on user
    
    $memberof = $objItem.GetEx("memberof")

    $objItem = 0
    
    If $memberof = 0 Then
        Dim $memberof[1] = [0]
        Return 0
    EndIf

I added a check to see if it was an object before doing the GetEx....

If IsObj($objItem) Then
    $memberof = $objItem.GetEx("memberof")
    EndIf

... but haven't tried it yet.

Link to comment
Share on other sites

I had similar problems - in my opinion it's a timing problem.

After inserting a "Sleep(100)" after each call to adfunctions the problem went away.

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.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 (NEW 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

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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...