Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to check LDAP path in active directory

Status
Not open for further replies.

cm6043

MIS
Dec 10, 2003
64
HK
Hi all,

Do soneone how check the ldap path of active directory object under windows 2000 server. For example I create a new domain user called test1. How can I check if its LDAP full path is cn=test1,ou=Users,dc=mycorp,dc=com? Thanks
 
Do a small vbscript.
Code:
set wshuser = getobject("LDAP://cn=test1,ou=Users,dc=mycorp,dc=com")

echo err

Save that as test.vbs then run cscript.exe //nologo test.vbs. If you get a 0 back then you were able to bind to that object and you have the correct path.
 
Hello all,

I would slightly amend what Micron1090 posted to make it good.
Code:
on error resume next
sdn = "cn=test1,ou=Users,dc=mycorp,dc=com"
set wshuser = getobject("LDAP://" & sdn)
if err.number<>0 then
    wscript.echo "error 0x" & hex(err.number) & vbcrlf & err.description
else
    wscript.echo "The target's distinguished name exists."
end if
set wshuser = nothing
The script if saved with .vbs, it can be executed by double-clicking on it.

Also maybe one-day you have to check other path, just change the sdn to your target and it will work the same.

regards - tsuji
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top