Talk About Network

Google





Software > ADSI General > Re: Searching f...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 2 of 3 Topic 5340 of 5437
Post > Topic >>

Re: Searching for users

by "Richard Mueller [MVP]" <rlmueller-nospam@[EMAIL PROTECTED] > Jul 25, 2008 at 08:22 PM

Cory wrote:

> I am trying to locate a user using LDAP. I may not know what OU the user

> is
> in. A query fails if I try something like:
>
> Set usr = GetObject("CN=Cory Laidlaw,DC=Beyond01,DC=local")
>
> However, if I give it the OU's it works fine. the problem is that I
don't
> want to assume my client will always create the user account in the same

> OU
> (for example, they don't use Small Business Server, which defaults to
the 
> OU
> 'SBSUsers'.)
>
> Is there a way to do this? Help! Thanks!!

If you know the sAMAccountName (the "pre-Windows 2000 logon name"), you
can 
use the IADsNameTranslate interface to convert this (in combination with
the 
NetBIOS name of the domain) to the Distinguished Name (DN). See this link:

http://www.rlmueller.net/NameTranslateFAQ.htm

If you know the Common Name (the value of the cn attribute) you must
search 
AD. And, there may be more than one user with the given Common Name (in 
different OU's). I use ADO in VBScript programs for this. See this link:

http://www.rlmueller.net/ADOSearchTips.htm

I have an example VBScript program that uses ADO to search for objects
that 
have a given Common Name linked here:

http://www.rlmueller.net/Search%20for%20Common%20Name.htm

The program outputs the DN's of all objects that have the given Common
Name. 
The link explains how to modify the program to only search for user
objects. 
You can also specify the wildcard "*" to find all objects (or users) with
a 
given string in their Common Name.

-- 
Richard Mueller
MVP Directory Services
Hilltop Lab - http://www.rlmueller.net
--
 




 3 Posts in Topic:
Searching for users
=?Utf-8?B?Q29yeSBKLiBMYWl  2008-07-25 09:52:02 
Re: Searching for users
"Richard Mueller [MV  2008-07-25 20:22:19 
Re: Searching for users
=?Utf-8?B?Q29yeSBKLiBMYWl  2008-07-29 10:13:03 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
localhost-V2008-12-19 Thu Jan 8 20:05:24 PST 2009.