'Karl's generic ADSI CherryPicker. 'If you don't know the property names, get 'em from adsiedit.msc. 'Basically this script will retrieve any AD property based on whatever property you know - provided it's unique. 'Even phone numbers work. The possibilities with this function are pretty much endless. For instance, let's say you have 'an account name (sAMAccountName in ADspeak). You know his ID is "kweckstr". You want to know his email address... 'Well, here you go. Just change the field, data and what to return to suit whatever the hell it is you want to pick. 'Vars adField="sAMAccountName" Data="kweckstr" WhatToReturn="mail" 'Call the function. mail=RetrieveValue(adField,Data,WhatToReturn) 'Output WScript.Echo " adField: " & adField WScript.Echo " Data: " & Date WScript.Echo "Data to Return: " & WhatToReturn & VbCrLf WScript.Echo " Data returned: " & mail 'Exit gracefully wscript.quit 'Below here be functions. Function RetrieveValue(DataType,Data,ObjName) 'WScript.Echo datatype 'WScript.Echo Data 'WScript.Echo objName Set oRootDSE = GetObject("LDAP://rootDSE") Set oConnection = CreateObject("ADODB.Connection") oConnection.Open "Provider=ADsDSOObject;" Set oCommand = CreateObject("ADODB.Command") oCommand.ActiveConnection = oConnection If DataType="EmployeeID" then oCommand.CommandText = ";(&(objectCategory=User)(" & DataType & "=" & Data & "*));" & objName & ";subtree" Else oCommand.CommandText = ";(&(objectCategory=User)(" & DataType & "=" & Data & "));" & objName & ";subtree" End If 'WScript.Echo oCommand.CommandText Set oRecordSet = oCommand.Execute on error resume Next 'WScript.Echo oRecordSet.Fields(objName) RetrieveValue = oRecordSet.Fields(objName) Set oRecordSet = Nothing Set oCommand = Nothing Set oConnection = Nothing Set oRootDSE = Nothing End Function