Title: LDAP'ing a computer object in AD
Anytime the question is
 
"I am looking for an object somewhere in the forest"
 
the answer is almost always, do a GC search of the attributes you know that are in the GC. In this case you can search on name or samaccountname.
 
If you can easily convert the dns name of the domain to a netbios name you can also use the translatename com object.
 
 
 
For an example of an ldap search, try this
 
adfind -gc -b -f name=computername -dn
 
That will pick your machine's default global catalog and search it looking for the computername of computername and spit out the dn of the object.
 
If you have the possibility of having multiple objects with that computer name, try instead
 
adfind -gc -b -f "&(objectcategory=computer)(name=computername)" -dn
 
 
 
C:\>adfind -adfind -gc -b -f "&(objectcategory=computer)(name=xplt)" -dn
 
AdFind V01.12.00cpp Joe Richards ([EMAIL PROTECTED]) May 2003
 
Using server: w2kasdc1.joehome.com
 
dn:CN=XPLT,CN=Computers,DC=joehome,DC=com
 
1 Objects returned
 
C:\>
 
 
  joe
 



From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Frederic Allaert
Sent: Thursday, October 16, 2003 9:50 AM
To: [EMAIL PROTECTED]

Hello all,

I have been searching some good, clear examples how to determine the LDAP path
for a computer object, (without knowing the "location" in AD), with the only input being
the hostname of the computer, and the DNS-name for the domain. All this using a .VBS-script...

Can someone produce such an example, or direct me to some good resource websites on this topic?

Greetings,

Frederic Allaert

Reply via email to