Sign in to follow this  
Followers 0
Graywalker

ADFunctions.au3 Error

2 posts in this topic

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.

Share this post


Link to post
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 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
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
Sign in to follow this  
Followers 0