break ON
dim $test[5]
$test[1]="abernade" ;I don't normally create arrays this way, but for simplicity
$test[2]="dbullock"
for $x=1 to 2
$str=""
$server=""
adsearch($test[$x])
? $str
? $server
next
Function ADSearch($ADAccountName)
Dim $AdoCon
dim $AdoCommand
dim $Recordset
dim $Filter
dim $homemdb
dim $store
if len($ADAccountName)>0
$filter=" where samAccountName='"+$ADAccountName+"' "
$AdoCon = CreateObject("ADODB.Connection")
$AdoCon.Provider = "ADsDSOObject"
; Current credentials are used, as username and password aren't specified
$AdoCon.Open("Active Directory Provider")
; Create ADO command object for the connection.
$AdoCommand = CreateObject("ADODB.Command")
$AdoCommand.ActiveConnection = $AdoCon
$AdoCommand.CommandText ="Select homemdb from 'LDAP://"+GetObject("LDAP://rootDSE").Get("defaultNamingContext")+"' "+$filter
; Execute the query.
$Recordset = $AdoCommand.Execute
$homeMDB=split($recordset.fields("homemdb"),",") ;This is the line where I get the IDispatch Pointers error
$store=split($homemdb[0],"=")
$str=$store[1]
$server=right($homemdb[3],4)
Else
Exit
endif
Endfunction