Jump to content

Recommended Posts

Posted (edited)

I modified my script a bit. You can now query a user or a computer and pass the object in the call to _GetLogin() - see post number 16.

Did you replace "PCTS29$" with your computername or username?

Edited 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

 

  • Replies 60
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Posted

I modified my script a bit. You can now query a user or a computer and pass the object in the call to _GetLogin() - see post number 16.

Did you replace "PCTS29$" with your computername or username?

I replaced the "PCTS29$" with my computer name but still get the error - is this the only place I need to ammend the script - I also tried the following line putting a CN=Computers in but that still errors.

$sTmp = StringSplit($sTmp[1],"CN=",1)

Posted

Do you have the trailing "$" so if your computername is "PC001" the parameter should read "PC001$"

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

Do you have the trailing "$" so if your computername is "PC001" the parameter should read "PC001$"

Yes - Have already tried that - If yours is working ok there must be something I am doing wrong - Will use a fresh pair of eyes tomorrow and recheck ..

Posted (edited)

I'm a bit stupid (today) :)

This is much simpler:

#include <adfunctions.au3>
#include <array.au3>                                    ; This line can be deleted 
Global $DCList, $LastLogin=0
_ADListDomainControllers($DCList)
_ArrayDisplay($DCList)                                  ; This line can be deleted
For $i =1 to $DCList[0]
    $sTmp = StringSplit($DCList[$i],",")
    $sTmp = StringSplit($sTmp[1],"CN=",1)
    $strHostServer = $sTmp[2]
    $sTmp = _ADGetLastLoginDate(@username)
    ConsoleWrite($strHostServer & ": " & $sTmp & @lf)   ; This line can be deleted
    If $sTmp > $LastLogin Then $LastLogin = $sTmp
Next
ConsoleWrite("LastLogin: " & $LastLogin & @lf)          ; This line can be deleted

First it displays the list of domain controllers. Every entry should look like:

CN=<Servername of domain controller we need for further processing>,<Rest>

Then it returns a line for every domain controller with name and found last login and an additional line with the calculated true last loging.

Edited 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

 

Posted

I'm a bit stupid (today) :)

This is much simpler:

#include <adfunctions.au3>
#include <array.au3>                                    ; This line can be deleted 
Global $DCList, $LastLogin=0
_ADListDomainControllers($DCList)
_ArrayDisplay($DCList)                                  ; This line can be deleted
For $i =1 to $DCList[0]
    $sTmp = StringSplit($DCList[$i],",")
    $sTmp = StringSplit($sTmp[1],"CN=",1)
    $strHostServer = $sTmp[2]
    $sTmp = _ADGetLastLoginDate(@username)
    ConsoleWrite($strHostServer & ": " & $sTmp & @lf)   ; This line can be deleted
    If $sTmp > $LastLogin Then $LastLogin = $sTmp
Next
ConsoleWrite("LastLogin: " & $LastLogin & @lf)          ; This line can be deleted

First it displays the list of domain controllers. Every entry should look like:

CN=<Servername of domain controller we need for further processing>,<Rest>

Then it returns a line for every domain controller with name and found last login and an additional line with the calculated true last loging.

I still get the same error - the error is comming from the ADFunctions.au3 include file :

adfunctions.au3 (949) : ==> Subscript used with non-Array variable.:

$DCList[$DCList[0]] = $temparray[0]

$DCList[$DCList[0]] = $temparray^ ERROR

Posted

It appears I am not getting the $DClist - Therefore there is no array to work on - This script really needs to do an isArray function to clarify the list was obtained ok. So I need to troubleshoot why _ADListDomainControllers($DCList) fails to connect to my DC and pull a list of domain controllers into an array .

I have admin rights and the OU is the same name "Domain Controllers" - So I cannot figure why this is not working .... I have looged at the function _ADListDomainControllers and I cannot see anything wrong - This is a dynamic function and does not need me to pipe anything into it that is specific to my environment -

Any Ideas.

Posted

Do you have the most current version of adfunctions.au3?

The first lines in my file look like:

#include-once
; Active Directory Function Library. Include this to allow access to Active Directory Functions

; Author : Jonthan Clelland
; Email : jclelland@statestreet.com
; Version : 3.1.1

;Version History -- Starting from v3.1

; 3.1 -- First released version
; 3.1.1 -- Bugfix to _ADGetObjectsInOU, default $filter value caused errors. Has been changed.
; 3.1.2 -- Corrections made to comments, replaced occurrences of 'Samaccountname' with 'Full Distringuished Name' where this had changed ibn the code.
; 3.1.2 -- Change to '_ADUserCreateMailbox', added '$emaildomain' and removed the hard-coded Email Domain name.
; 3.1.3 -- Change to '_ADCreateUser', added .Put("userPrincipalName", $user & "@" & $domainext), where $domainext is the Domain in the form 'domain.mydomain.com'

; _ADDoError  : Error event handler for COM errors. This is global so will pick up errors from your program if you include this library

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

Do you have the most current version of adfunctions.au3?

The first lines in my file look like:

#include-once
; Active Directory Function Library. Include this to allow access to Active Directory Functions

; Author : Jonthan Clelland
; Email : jclelland@statestreet.com
; Version : 3.1.1

;Version History -- Starting from v3.1

; 3.1 -- First released version
; 3.1.1 -- Bugfix to _ADGetObjectsInOU, default $filter value caused errors. Has been changed.
; 3.1.2 -- Corrections made to comments, replaced occurrences of 'Samaccountname' with 'Full Distringuished Name' where this had changed ibn the code.
; 3.1.2 -- Change to '_ADUserCreateMailbox', added '$emaildomain' and removed the hard-coded Email Domain name.
; 3.1.3 -- Change to '_ADCreateUser', added .Put("userPrincipalName", $user & "@" & $domainext), where $domainext is the Domain in the form 'domain.mydomain.com'

; _ADDoError  : Error event handler for COM errors. This is global so will pick up errors from your program if you include this library

Yes... - I reinstalled AutoIt 3.281 and even trawelled the forum under the ADFunctions topic and on page 10 there are 2 versions listed - I have tried the latest and still no joy -

I slotted the following into the Adfunctions scrips to see if it is getting the name of a DC and it is - It just wont populate the array with a list of DC`s - it gets the same error every time - I am completly baffled - I have tried on another machine but this simply does not work.

$objCommand.CommandText = "Select distinguishedName FROM 'LDAP://" & $strHostServer & "/ou=Domain Controllers," & $strDNSDomain & "' WHERE objectclass='computer'"

msgbox(0, "", $strHostServer)- - Returns my server name

??????????

Posted (edited)

Hey guys...

nice to meet you - I was currently in search for something to look up the DCs of the current domain when I found your thread. I use the following code (yours, water, changed only variable names to meet out requirements here):

#include <Array.au3>

Global $s_DomainController


$s_DomainController  = GetDC($s_DomainController)


If IsArray($s_DomainController) Then
    _ArrayDisplay($s_DomainController)
Else
    MsgBox("", "TEST", $s_DomainController)
    Exit
EndIf


; The function GetDC() checks for the DC of the current domain
; ==================================================================================================
Func GetDC(ByRef $s_DomainController)
    Global $o_Connection = ObjCreate("ADODB.Connection") ; Create COM object to AD
    $o_Connection.ConnectionString = "Provider=ADsDSOObject"
    $o_Connection.Open("Active Directory Provider") ; Open connection to AD

    Global $o_RootDSE = ObjGet("LDAP://RootDSE")
    Global $s_DNSDomain = $o_RootDSE.Get("defaultNamingContext") ; Retrieve the current AD domain name
    Global $s_HostServer = $o_RootDSE.Get("dnsHostName") ; Retrieve the name of the connected DC
    Global $s_Configuration = $o_RootDSE.Get("ConfigurationNamingContext") ; Retrieve the Configuration naming context
    Global $o_OpenDS = ObjGet("LDAP:")
        
    $o_CMD = ObjCreate("ADODB.Command")
    $o_CMD.ActiveConnection = $objConnection
    $o_CMD.Properties("Page Size") = 1000
    $o_CMD.Properties("Searchscope") = 2
   
    $o_CMD.CommandText = "Select distinguishedName FROM 'LDAP://" & $s_HostServer & "/ou=Domain Controllers," & $s_DNSDomain & "' WHERE objectclass='computer'"
   
    $o_RecordSet = $o_CMD.Execute
    Local $s_DomainController[$o_RecordSet.RecordCount + 1]
    $o_RecordSet.MoveFirst
   
    Do
        $s_DomainController[0] += 1
       
        $o_CMD.CommandText = "<LDAP://" & $s_HostServer & "/" & $o_RecordSet.Fields("distinguishedName" ).Value & ">;;serverReferenceBL;Range=0-*;base"
        $o_RecordSet2 = $o_CMD.Execute
       
        $o_RecordSet2.MoveFirst
        Do
            $temparray = $o_RecordSet2.Fields(0).Value
            $s_DomainController[$s_DomainController[0]] = $temparray[0]
            $o_RecordSet2.MoveNext
        Until $o_RecordSet2.EOF
       
        $o_RecordSet.MoveNext
    Until $o_RecordSet.EOF
   
    $o_CMD = 0
    $o_RecordSet = 0
    Return
EndFunc   ;==>_ADListDomainControllers

If I run this on one of my DCs, I get a Msgbox showhing the value "0" for "$s_DomainController". There could be a problem with the line:

CODE
Dim $s_DomainController[$o_RecordSet.RecordCount + 1]
...because when I change the "Dim" to "Local" there is an error when running the script: "Cannot redeclare a parameter inside a user function". Maybe this helps? Edited by cherdeg
Posted

Hey guys...

nice to meet you - I was currently in search for something to look up the DCs of the current domain when I found your thread. I use the following code (yours, water, changed only variable names to meet out requirements here):

#include <Array.au3>

Global $s_DomainController


$s_DomainController  = GetDC($s_DomainController)


If IsArray($s_DomainController) Then
    _ArrayDisplay($s_DomainController)
Else
    MsgBox("", "TEST", $s_DomainController)
    Exit
EndIf


; The function GetDC() checks for the DC of the current domain
; ==================================================================================================
Func GetDC(ByRef $s_DomainController)
    Global $o_Connection = ObjCreate("ADODB.Connection") ; Create COM object to AD
    $o_Connection.ConnectionString = "Provider=ADsDSOObject"
    $o_Connection.Open("Active Directory Provider") ; Open connection to AD

    Global $o_RootDSE = ObjGet("LDAP://RootDSE")
    Global $s_DNSDomain = $o_RootDSE.Get("defaultNamingContext") ; Retrieve the current AD domain name
    Global $s_HostServer = $o_RootDSE.Get("dnsHostName") ; Retrieve the name of the connected DC
    Global $s_Configuration = $o_RootDSE.Get("ConfigurationNamingContext") ; Retrieve the Configuration naming context
    Global $o_OpenDS = ObjGet("LDAP:")
        
    $o_CMD = ObjCreate("ADODB.Command")
    $o_CMD.ActiveConnection = $objConnection
    $o_CMD.Properties("Page Size") = 1000
    $o_CMD.Properties("Searchscope") = 2
   
    $o_CMD.CommandText = "Select distinguishedName FROM 'LDAP://" & $s_HostServer & "/ou=Domain Controllers," & $s_DNSDomain & "' WHERE objectclass='computer'"
   
    $o_RecordSet = $o_CMD.Execute
    Local $s_DomainController[$o_RecordSet.RecordCount + 1]
    $o_RecordSet.MoveFirst
   
    Do
        $s_DomainController[0] += 1
       
        $o_CMD.CommandText = "<LDAP://" & $s_HostServer & "/" & $o_RecordSet.Fields("distinguishedName" ).Value & ">;;serverReferenceBL;Range=0-*;base"
        $o_RecordSet2 = $o_CMD.Execute
       
        $o_RecordSet2.MoveFirst
        Do
            $temparray = $o_RecordSet2.Fields(0).Value
            $s_DomainController[$s_DomainController[0]] = $temparray[0]
            $o_RecordSet2.MoveNext
        Until $o_RecordSet2.EOF
       
        $o_RecordSet.MoveNext
    Until $o_RecordSet.EOF
   
    $o_CMD = 0
    $o_RecordSet = 0
    Return
EndFunc   ;==>_ADListDomainControllers

If I run this on one of my DCs, I get a Msgbox showhing the value "0" for "$s_DomainController". There could be a problem with the line:

CODE
Dim $s_DomainController[$o_RecordSet.RecordCount + 1]
...because when I change the "Dim" to "Local" there is an error when running the script: "Cannot redeclare a parameter inside a user function". Maybe this helps?
I tried your script and get a similar error to the ones I have been getting

(50) : ==> Subscript used with non-Array variable.:

$s_DomainController[$s_DomainController[0]] = $temparray[0]

$s_DomainController[$s_DomainController[0]] = $temparray^ ERROR

Posted

I debugged the loop function to se if I was pulling thru the domain controllers and they are all appearing ...

My test

Do

$s_DomainController[0] += 1

$o_CMD.CommandText = "<LDAP://" & $strHostServer & "/" & $o_RecordSet.Fields("distinguishedName" ).Value & ">;;serverReferenceBL;Range=0-*;base"

MsgBox(0, "", $o_CMD.CommandText)

$o_RecordSet2 = $o_CMD.Execute

;$o_RecordSet2.MoveFirst

;Do

; $temparray = $o_RecordSet2.Fields(0).Value

; $s_DomainController[$s_DomainController[0]] = $temparray[0]

; $o_RecordSet2.MoveNext

;Until $o_RecordSet2.EOF

$o_RecordSet.MoveNext

Until $o_RecordSet.EOF

Posted

Ok the 2 lines that are spitting the dummy are

$temparray = $o_RecordSet2.Fields(0).Value

$s_DomainController[$s_DomainController[0]] = $temparray[0]

Seems all the DC names are comming thru but $TempArray cannot read past the first value - It spits out the first DC and then falls over.

Posted (edited)

Got it - just remove the msgbox'es (meanwhile I did):

#include <Array.au3>

Global $a_DomainController

$a_DomainController = GetDC()

If IsArray($a_DomainController) Then
    _ArrayDisplay($a_DomainController)
Else
    MsgBox("", "TEST", $a_DomainController) ; "0"
    Exit
EndIf


; The function GetDC() checks for the DC of the current domain
; ==================================================================================================
Func GetDC()
    Global $o_Connection = ObjCreate("ADODB.Connection") ; Create COM object to AD
    $o_Connection.ConnectionString = "Provider=ADsDSOObject"
    $o_Connection.Open("Active Directory Provider") ; Open connection to AD

    Global $o_RootDSE = ObjGet("LDAP://RootDSE")
    Global $s_DNSDomain = $o_RootDSE.Get("defaultNamingContext") ; Retrieve the current AD domain name
    Global $s_HostServer = $o_RootDSE.Get("dnsHostName") ; Retrieve the name of the connected DC
    Global $s_Configuration = $o_RootDSE.Get("ConfigurationNamingContext") ; Retrieve the Configuration naming context
    Global $o_OpenDS = ObjGet("LDAP:")
        
    $o_CMD = ObjCreate("ADODB.Command")
    $o_CMD.ActiveConnection = $o_Connection
    $o_CMD.Properties("Page Size") = 1000
    $o_CMD.Properties("Searchscope") = 2
   
    $o_CMD.CommandText = "Select distinguishedName FROM 'LDAP://" & $s_HostServer & "/ou=Domain Controllers," & $s_DNSDomain & "' WHERE objectclass='computer'"
    $o_RecordSet = $o_CMD.Execute
    
    Local $s_DC[$o_RecordSet.RecordCount + 1]
    $o_RecordSet.MoveFirst
   
    Do
        $s_DC[0] += 1
       
        $o_CMD.CommandText = "<LDAP://" & $s_HostServer & "/" & $o_RecordSet.Fields("distinguishedName" ).Value & ">;;serverReferenceBL;Range=0-*;base"
        $o_RecordSet2 = $o_CMD.Execute
       
        $o_RecordSet2.MoveFirst
        Do
            $temparray = $o_RecordSet2.Fields(0).Value
            $s_DC[$s_DC[0]] = $temparray[0]
            $o_RecordSet2.MoveNext
        Until $o_RecordSet2.EOF
       
        $o_RecordSet.MoveNext
    Until $o_RecordSet.EOF
   
    $o_CMD = 0
    $o_RecordSet = 0
    Return $s_DC
EndFunc   ;==>_ADListDomainControllers

This returns an array as it should. The problem seems related to passing an empty variable to the function using "ByRef". Passing nothing into it and just declaring the variable and filling it with the function's return does the trick (at least for me). Doing it this way you can also get rid of the deprecated "Dim". I played 'round with "ReDim" but that didn't work either.

Edited by cherdeg
Posted

Got it - just remove the msgbox'es (meanwhile I did):

#include <Array.au3>

Global $s_DomainController

$s_DomainController = GetDC()

If IsArray($s_DomainController) Then
    _ArrayDisplay($s_DomainController)
Else
    MsgBox("", "TEST", $s_DomainController) ; "0"
    Exit
EndIf


; The function GetDC() checks for the DC of the current domain
; ==================================================================================================
Func GetDC()
    Global $o_Connection = ObjCreate("ADODB.Connection") ; Create COM object to AD
    $o_Connection.ConnectionString = "Provider=ADsDSOObject"
    $o_Connection.Open("Active Directory Provider") ; Open connection to AD

    Global $o_RootDSE = ObjGet("LDAP://RootDSE")
    Global $s_DNSDomain = $o_RootDSE.Get("defaultNamingContext") ; Retrieve the current AD domain name
    Global $s_HostServer = $o_RootDSE.Get("dnsHostName") ; Retrieve the name of the connected DC
    Global $s_Configuration = $o_RootDSE.Get("ConfigurationNamingContext") ; Retrieve the Configuration naming context
    Global $o_OpenDS = ObjGet("LDAP:")
        
    $o_CMD = ObjCreate("ADODB.Command")
    $o_CMD.ActiveConnection = $o_Connection
    $o_CMD.Properties("Page Size") = 1000
    $o_CMD.Properties("Searchscope") = 2
   
    $o_CMD.CommandText = "Select distinguishedName FROM 'LDAP://" & $s_HostServer & "/ou=Domain Controllers," & $s_DNSDomain & "' WHERE objectclass='computer'"
    $o_RecordSet = $o_CMD.Execute
    
    Local $s_DC[$o_RecordSet.RecordCount + 1]
    $o_RecordSet.MoveFirst
   
    Do
        $s_DC[0] += 1
       
        $o_CMD.CommandText = "<LDAP://" & $s_HostServer & "/" & $o_RecordSet.Fields("distinguishedName" ).Value & ">;;serverReferenceBL;Range=0-*;base"
        $o_RecordSet2 = $o_CMD.Execute
       
        $o_RecordSet2.MoveFirst
        Do
            $temparray = $o_RecordSet2.Fields(0).Value
            $s_DC[$s_DC[0]] = $temparray[0]
            $o_RecordSet2.MoveNext
        Until $o_RecordSet2.EOF
       
        $o_RecordSet.MoveNext
    Until $o_RecordSet.EOF
   
    $o_CMD = 0
    $o_RecordSet = 0
    Return $s_DC
EndFunc   ;==>_ADListDomainControllers

This returns an array as it should. The problem seems related to passing an empty variable to the function using "ByRef". Passing nothing into it and just declaring the variable and filling it with the function's return does the trick (at least for me).

It does NOT return an array - I get the same error

$o_RecordSet2.Fields(0).Value contains the server names but it is not populating an arry with the line $temparray = $o_RecordSet2.Fields(0).Value

when I do

$ArrayValid = IsArray($temparray)

MsgBox(0, "", $ArrayValid)

I get a 0 - TempArray is failing to create with the record Sets

Posted (edited)

It does NOT return an array - I get the same error

I'm really sorry for you, but, yes - it does, please see my attachment. To try again, please just copy'n'paste 1:1 from my codebox.

test.bmp

Edited by cherdeg
Posted

I'm really sorry for you, but, yes - it does, please see my attachment.

I dont doubt it works and the AdFunctions include works. There is something wrong on my machine(s) that means

$temparray = $o_RecordSet2.Fields(0).Value

Does not work

It will not build an array from $o_RecordSet2.Fields(0).Value even though $o_RecordSet2.Fields(0).Value

contains values that I can read in the loop if I rem out the 2 lines containing $temparray

Posted (edited)

I dont doubt it works and the AdFunctions include works. There is something wrong on my machine(s) that means

Are you testing on an AD-DomainController or an AD-DomainMember? Edited by cherdeg
Posted (edited)

What I've found so far:

  • I think we have different versions of adfunctions.au3. The line numbers and the code on this line don't fit with my version. Therefore I'll attach my version of adfunctions.au3
  • When using _ADListDomainControllers you have to provide the Array as an argument. The function always seem to return 0. So a call like "$DCList = _ADListDomainControllers($DCList) overwrites the $DCList Array which has been populated by the function with the returncode. You should call the function without assignment "_ADListDomainControllers($DCList)"
  • If you still have problems could you please run my script from posting 25 with the attached adfunctions.au3 and return the console output?
Do you run your tests on a Server directly? The scripts should run fine from any PC. Edited 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

 

Posted

What I've found so far:

  • I think we have different versions of adfunctions.au3. The line numbers and the code on this line don't fit with my version. Therefore I'll attach my version of adfunctions.au3
  • When using _ADListDomainControllers you have to provide the Array as an argument. The function always seem to return 0. So a call like "$DCList = _ADListDomainControllers($DCList) overwrites the $DCList Array which has been populated by the function with the returncode. You should call the function without assignment "_ADListDomainControllers($DCList)"
  • If you still have problems could you please run my script from posting 25 with the attached adfunctions.au3 and return the console output?
I don't have "adfunctions.au3" at all; I only use the code posted here - and if I look right at your script, you also needn't include the whole monster. The function itself works with the changes I posted here:

- Don't call with "ByRef $DCList"

- Don't use "Dim" inside but "Local"

- Return "$DCList"

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
  • Recently Browsing   0 members

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