If using an LDAP query (not sure if you need the server name in there in your case):
<LDAP://SERVERNAME/DC=bobdom,DC=net>;(&(objectClass=user)([email protected]));
Trying it out in my own environment, it looks like this (with a couple things genericized):
<LDAP://SERVERNAME/DC=bobdom,DC=net>;(&([email protected]));name,mail,member,description,memberOf,userParameters,userAccountControl,whenCreated,CN;subTreeCount=1
And the whole batch looks like this (in ASP; if done in a .vbs file you'll need to change the Server.CreateObject
to just CreateObject
... I think).
Set oCon = Server.CreateObject("ADODB.Connection")
oCon.Provider = "ADsDSOObject"
oCon.Open "ADProvider", "ADUsername", "ADPassword"
Set oCmd = Server.CreateObject("ADODB.Command")
Set oCmd.ActiveConnection = oCon
sQuery = "<LDAP://SERVERNAME/DC=bobdom,DC=net>;(&([email protected]));name,distinguishedName,physicalDeliveryOfficeName;subTreeCount=1>"
oCmd.CommandText = sQuery
Set ADRecordSet = oCmd.Execute
You may need to fiddle with subTreeCount
.