Hej Spottie !
Er det ikke noget i denne stil, du leder efter ?
(Husk, at rette strdomain og strinitialer :o) )
strdomain = "dc=int,dc=dragsted,dc=com"
strinitialer = "mbh"
Const ADS_SCOPE_SUBTREE = 2
Set objConnection = CreateObject("ADODB.Connection")
Set objCommand = CreateObject("ADODB.Command")
objConnection.Provider = "ADsDSOObject"
objConnection.Open "Active Directory Provider"
Set objCommand.ActiveConnection = objConnection
objCommand.Properties("Page Size") = 1000
objCommand.Properties("Searchscope") = ADS_SCOPE_SUBTREE
objCommand.CommandText = _
"SELECT distinguishedName FROM '
LDAP://" & strdomain & "' WHERE objectCategory='user' " & _
"AND sAMAccountName='" & strinitialer & "'"
Set objRecordSet = objCommand.Execute
objRecordSet.MoveFirst
Do Until objRecordSet.EOF
msgbox objRecordSet.Fields("distinguishedName").Value
objRecordSet.Movenext
Loop
/Killer