Here is one that Shawn came up with for me. Not exactly what you are asking for, but might give you some ideas.

 Code:

$Form1 = $System.Form()
$Form1.StartPosition = 2  ;FormStartPosition_WindowsDefaultLocation
$Form1.Size = $System.Size(640,480) ;(Width,Height)
$Form1.Text = "User Account Manager - Release "+$Version
$Form1.ShowInTaskbar = "True"
$Form1.ControlBox = "False" 
$Form1.MaximizeBox = "False" 
$Form1.MinimizeBox = "True" 


$TextBox1 = $System.TextBox()
$TextBox1.Left = 130
$TextBox1.Text = ""
$TextBox1.Top = 7
$TextBox1.Width = 104
$TextBox1.KeyUp = "TextBox_KeyUp()"
$nul = $Form1.Controls.Add($TextBox1)

$PrimaryAttributes = "Name","SamAccountName"

$UserArray = FnLDAPQuery($PrimaryAttributes,,"(objectClass=User)",,"SUBTREE" )

Function TextBox_KeyUp() 

Dim $Len,$Pos,$KeyCode,$i
 $Len = Len($TextBox1.Text) 
 $Pos = $TextBox1.SelectionStart 
 
 $KeyCode = $System.EventArgs.KeyCode 

 If $KeyCode = 13 
 $textbox1.text = $userarray[$flag2,1]
  Return
 EndIf 

 For $i = 0 to UBound($UserArray) 
  If $Len > 0 
   If Left($UserArray[$i,0],$Len) = $TextBox1.Text 
    $TextBox1.Text = $UserArray[$i,0] 
    $TextBox1.SelectionStart = $Pos 
    $TextBox1.SelectionLength = 999 
    $Flag2 = $i
   EndIf 
  EndIf 
 Next 

EndFunction 

Function fnLDAPQuery($What,Optional $From,Optional $Filter,Optional $OrderBy,Optional $Scope,
    Optional $User,Optional $Pswd)
    
    Dim $oCon,$oCMD,$oRS,$sQ,$aR,$C,$R
    
    $sQ="<"+IIf($From="","LDAP://"+GetObject("LDAP://rootDSE").Get("defaultNamingContext"),
        $From)+">;"+$Filter+";"+IIf(VarType($What)>8192,Join($What,','),$What)+";"+
        IIf($Scope<>"base" And $Scope<>"onelevel","subtree",$Scope)
    
    $oCon=CreateObject("ADODB.Connection")
    $oCon.Provider="ADsDSOObject"
    $oCon.Properties("Encrypt Password").Value=1
    $oCon.Properties("ADSI Flag").Value=1
    If $User And $Pswd
        $oCon.Properties("User ID").Value=$User
        $oCon.Properties("Password").Value=$Pswd
    EndIf
    $oCon.Open("Active Directory Provider")
     
    $oCMD=CreateObject("ADODB.Command")
    $oCMD.ActiveConnection=$oCon
    $oCMD.CommandText=$sQ
    $oCMD.Properties("Page Size").Value=1000
    $oCMD.Properties("Timeout").Value=30
    $oCMD.Properties("Cache Results").Value=0
    
    If InStr($OrderBy,"distinguishedName")
        $oRS=CreateObject("ADODB.Recordset")
        $oRS.CursorLocation=3
        $oRS.Sort=$OrderBy
        $oRS.Open($sQ,$oCon,0,1,1)
    Else
        If $OrderBy
            $oCMD.Properties("Sort On").Value=$OrderBy
        EndIf
        $oRS=$oCMD.Execute
    EndIf
    If @ERROR Exit @ERROR EndIf
    If $oRS.BOF And $oRS.EOF Exit @ERROR EndIf
    
    $aR = $oRS.GetRows()
    Dim $aFR[UBound($aR,2),UBound($aR,1)]
    For $R=0 to UBound($aR,2)
        For $C=0 to UBound($aR,1)
            $aFR[$R,$C]=$aR[$C,$R]
        Next
    Next
    
    $fnLDAPQuery=$aFR
EndFunction
_________________________
Today is the tomorrow you worried about yesterday.