Link to home
Start Free TrialLog in
Avatar of randyt200
randyt200

asked on

Finding Users RDN

How do I search AD to find out a users RDN?  I want to create a vbscript that goes out and finds a users RDN.  Problem is that the user may be in a OU or a CN (will be used to query different users)

I know I need to bind to AD, then query the user.  Do I have to go through the GC? or can i just do an LDAP call?
Avatar of dlwyatt82
dlwyatt82
Flag of Canada image

You can search the directory for a partcular user, and then read the user's IADs::Name property to get the RDN (I believe there is also an IADs::Get_Name method to retrieve this data). See the following section of the Active Directory Programmer's Guide at http://msdn.microsoft.com/library/default.asp?url=/library/en-us/ad/ad/searching_active_directory.asp for information on how to perform a search of the directory with a query.

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/adsi/adsi/iadsuser.asp details the properties and methods of IADsUser, including those it inherits from IADs (such as Name and Get_Name).
ASKER CERTIFIED SOLUTION
Avatar of Colosseo
Colosseo
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial