I think you want IADsNameTranslate Brian assuming you are using ADSI. 

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/adsi/adsi/iadsnametranslate.asp


Richard has a good writeup on it at 

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


Basically you convert from ADS_NAME_TYPE_1779 to ADS_NAME_TYPE_NT4 and then chop off 
the domain piece. 


If you are in batch, take a look at my UserName tool on www.joeware.net which will 
return whatever format you want for the current user. 


  joe


-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Brian Desmond
Sent: Sunday, August 29, 2004 4:09 PM
To: [EMAIL PROTECTED]
Subject: [ActiveDir] Determine user's Netbios/DNS Domain Name

Is there an attribute that I can look at if I'm bound to a username to find out the 
user's domain name?
 
For example, if I'm bound to myself:
 
 CN=$Brian Desmond,OU=Tech Dept,OU=Accounts,DC=payton,DC=cps,DC=k12,DC=il,DC=us
 
How can I programatically determine one of the two: my netbios domain name is WPCP or 
my DNS name is payton.cps.k12.il.us?
 
Thanks,
Brian
..jjryãv

List info   : http://www.activedir.org/mail_list.htm
List FAQ    : http://www.activedir.org/list_faq.htm
List archive: http://www.mail-archive.com/activedir%40mail.activedir.org/

Reply via email to